Sunday, November 26, 2017

MyTraffic Light

This app is to create Trafic app for BBB on the RPi.
see Traffic control example running on a Beagle Bone Black for background.
Breadboard Wiring

Wiring to RPi












RPi wiring
Traffic light (Red,Yellow,Green= (pins 11,13,15) = (GPIO 17,13, 22)
Pedestrian (Red,           ,Green= (pins12,    ,16)  = (GPIO 12,    ,23)

  • Connect LED+ to a GPIO pin on the RPi
  • Connect LED- to resistor (used 330 Ohms)
  • Connect resistors to breadboard negative line,
  • which should be connected to a ground pin on RPi (used pin 6=GND)

Trafic system

Click on System and then on the  Virtual DNS tab at bottom and all variables, like %SCADA_Enable%,  and their values appear :)

Saturday, November 25, 2017

Blinky on Raspberry Pi

Test Environment and other requirements
  • Used mobile phone to create a network with 2 nodes. Interesting since no longer just using localhost.
  • ipconfig (windows) and ifconfig (raspbian)  identified the net ip address to use for the respective devices.
  • GPIO pin #s are used as expected like other SysFs RPi examples
  • Start forte on the Raspberry Pi as follows. It requires sudo to work and of course the ip addr:port as input
    • cd to directory with the forte executable:
    • sudo ./forte -c :61499
  • When using Publish and Subscribe use multicast IP addresses with unique ports.
    • See  FBDK/IP in 4diac documentation for more details.

Test Apps
Needed to use step-wise refinement to be sure the parts worked.
App1: LEDon Turn RPi led on
Tested: (RPI only)
*if the communication from 4diac-IDE to RPi worked
*if pin numbering is GPIO numbering
*simple sysFS communication test
App2: LEDauto : Blink RPi led
Tested:  (RPI only) Using sysFS more
App3ALEDstart_Stop:  (added RPI > status to PC) Blink RPi led and reflect in FBRT WINDOW via BOOL_OUT with a PC "led" 
Tested: Publish / Subscribe to PC from RPi
App3B: LEDstart_Stop:  (added PC control of RPi) Via Start and Stop buttons on PC in a FBRT_WINDOW control starting and stopping the blinking of the RPI led and the PC "led" to reflect RPi activity 
Tested: Publish / Subscribe to RPi from PC  to control RPi

LED test app Win10

[Some apps and links in older posts no longer exist, so screen shots so not lost.]

Idea is an app where the LED specifics can be mapped to different devices.

Since the LED specific parameters and interfaces are different, this is not a true build once run anywhere. This will be addressed in later post where a wrapper will hide the differences and  limitations that come from hiding the differences will discussed.

PC LED Test App from current (Nov.2017) with LED added via FBDK > HMI > OUT_BOOL FB
Also needed to add for connection between devices a Publish E_SR Q output  (FORTE_PC) to OUT_BOOL FB IN (FBDK_WINDOW) via Subscribe.


System Configuration

Devices are both on PC, but running different IEC61499 tools.

Application (Distributed)

.

Connections between devices

FBDT_WINDOW.PANEL_RESOURCE


FORTE_PC.EMB_RESOURCE     (EMB=embedded)

APP Deployed

Press START button and led1 alternates between black and red.


Tuesday, November 14, 2017

O/S and HW to run 4DIAC

As 4DIAC gets better, most O/S environments work with pre-compiled exe    

O/S currently:
  • Windows: Virtual Studio set-up is easier because Eclipse set-up uses cygwin, whose set-up is harder.  Majority of 4DIAC downloads are still from Windows.
  • Linux: Flavor used doesn't matter, Debian, Raspbian, Ubuntu, Cent OS etc. etc. Most documentation using Debian based packaging command. Favored by 4DIAC developers.
  • Mac (CACAO): Similar to Linux, but don't know anyone personally using, but often used by developers.
4DIAC Hardware comparison for hobbyist or a class:
  • Raspberry Pi models,  Several Raspberry Pi models supported and used in examples and real apps.
  • Beagle Board models, 4DIAC Trafic example uses Beagle Bone Black
  • Or donated HW 

Monday, November 13, 2017

Current 4DIAC class set-ups

(My current understand of )
These are the current 4DIAC class set-ups:

1. TU Wien Seminar

  • HW: Beckhoff?

2. Demos
  • HW - Beagle Bone (Black)
  • O/S - Debian
  • Demo app(s) - traffic light
  • Location - Off-site at conference or business
3. Demo - Hardware specific
  • HW - Company specific
  • O/S - Debian
  • Demo app(s) - ?
  • Location - Off-site at conference or business

Sunday, October 29, 2017

Finding EV3dev IP address


EV3 is connected to internet via USB cable to laptop. 
Tested with :
Laptop: Ethernet plug-in connection to internet 
EV3 :    usb cable to laptop sharing laptop's internet

Use ssh to log into the EV3DEV  (id: robot password: maker)

Started with: Determine Your Private and Public IP Addresses from the Command Line but needed to replace eth0 with usb1

Displaying private IP addresses

Note: Host laptop has different private IP address

$ hostname -I
Result: 192.168.137.3

$ /sbin/ifconfig
Result: usb1      Link encap:Ethernet  HWaddr 22:16:53:51:62:2f
  inet addr:192.168.137.3  ...

$ /sbin/ifconfig usb1 | grep Mask
Result:  inet addr:192.168.137.3  Bcast:192.168.137.255  Mask:255.255.255.0 .....

$ ip addr show usb1
result: 
3: usb1: ....
    link/ether...
    inet 192.168.137.3/24 ....
    ....

$ ip addr show usb1 | grep 'inet ' | awk '{print $2}' | cut -f1 -d'/'
result: 192.168.137.3

Displaying the public IP address

Note: Host laptop has same public IP address

http://www.ifconfig.me  (etc)
[curl not installed on ev3dev]

$ wget -qO- ifconfig.me
search for ip_address 

Saturday, October 28, 2017

First look at Lego Water Pumps


How does a water fountain pump work?


Fountain Pumps. The pump is the unseen heart of your fountain. Submerged in the reservoir, the pump draws water into its housing, where an impeller (a water propeller spun by electricity) forces the water out through the pump's outflow fitting.

source: fountainfinder.com/fountain_pumps.htm


4diac task idea using Stepwise refinement

Task 1: Student builds own water pump and test as a fountain
  • Simple to build out of Lego parts in 1/2 hour or less as shown in short videos. Student can also pick how to build their impeller from examples or own ideas.
  • Any motor can be used, so will work for Raspberry Pi or any HW supporting a motor.
Task 2: Water goes into another container then...
    • measure height of water left to know when to stop
    • measure of water in new container to know when to stop
    • measure water rate of flow based on water delivered in specific time (or via water height)
Task 3:  Student ideas for different flow rates and start and stop when ???

Construction

Coming screen shots from videos to help with my first water pump construction try. 
  • All examples used Lego motors and Technic parts, but no Lego EV3 nor programming. 
  • No standardized task description or construction was found.
12/9/17 Simple pump working (repeatable and have videos to chose to post) BUT would like a stronger pump that pumps higher. Easier to put in an larger student project scenario.

1/4/18 update... Will try with a medium power fn motor just got since using EV3 motor it was hard to get enough power to pump the water very high. Will try MattD600 video model and instructions next. Didn't have parts for the propeller nor same kind of motor until now.

Video Examples

  • All examples used Lego motors and Technic parts
  • None use Lego EV3 nor any programming. 
  • Motor on top parallel to top of fountain
  • Water intake usually on bottom
    • So need small legs so water get underneath
  • Pipes are narrow (1-2 dots wide) to help force the water up
Lego Water pump video Link collection with notes

Lego (Technic) Water Pump Building Instructions


Lego (Technic) Water Pump - MOC 

Working Lego Centrifugal Water Pump (with instructions) [MattD600] Has parts and most detailed instructions. Explains how pump works well. 
 [1/4/18] Now have some parts needed for propeller didn't have before and can try flipping the physical motor set switch in application.

Lego water pump tutorial ... 
  • Motor mounts on top are very clear
  • Curved impeller housing
  • Bit chaotic as he forgot how he built it.
Lego water pump tutorial. pumps a lot of water
  • Design simple but good
    • impeller and housing are simple, but effective design
  • Explains details like when weighting is needed
Lego Water Pump V2
  • Different motor connection to impeller
  • Strong simple impeller with more than 3 blades
    • Note: His faster v3 impeller has 3 blades.
  • Very strong water flow
  • Less leakage if long solid pieces on side
Lego water pump tutorial (Pumps Alot Of Water!)
  • Shows building pipe in detail
Working Lego Centrifugal Water Pump (with instructions)
  • Another impeller idea
  • Complete building instructions

Education appropriate apps

Apps appropriate for education if:
  • Similar to real life industrial apps
  • Construction in Lego possible with reasonable amount of parts
  • Construction able to be moved
    • Extra plus if simple enough students can build
  • Possible with some HW and 4diac
  • Basic app can be improved some
So far....

++ Lego EV3 Model Color Sorter

Video:LEGO® MINDSTORMS® Education EV3 Color Sorter.
Program: Program with description.
Construction:  
 Needs EV3 basic core edu set and 2-5 hours to build (long for class)

+++ Lego Water Pump

Video: Many videos, nothing standardized. See separate exploratory post (coming) for links with notes.
Program: None, but student could be assigned to pump water from one container to another and stop when water at correct height or too low or test rate of flow.
Construction:  Simple enough students could build quickly and design own impeller

  • See videos for How Tos now
  • Needs regular Lego parts

+ Automated LEGO warehouse, AS-RS system

Video:of Automated LEGO warehouse, AS-RS system 
++-Program (s) : Realistic app, but program not shared, but could be replicated with each student group doing a part
+--Construction:  


  • +Not shared, but simple enough to be replicated from video. 
  • - Probably too many Lego parts needed to be feasible.

Lego EV3 pgm blks vs 4DIAC FBs

Compare 
  • Lego EV3 programming blocks apps from National Instruments (IEC 61311 based) 
  • to 4DIAC apps and IEC61499 FBs 
  1. General mapping of features to features
  2. Example mapping for EV3 Model Color Sorter program 
  3. Example equivalent 4diac app

General mapping of features to features

Summary:
  • Event actions 
    • Lego - Event action takes several blocks
      • Action until
      • Event timer trigger
      • Stop Action
    • 4diac - Event driven via event trigger to fb
  • Inputs
    • Lego - Connector at bottom of pgm blk with curve down
    • 4diac - Connector on left of FB
  • Outputs
    • Lego - Connector at bottom of pgm blk  with curve up
    • 4diac - Connector on right of FB
  • Loops
    • Lego - have event trigger test at beginning or end (or both)
    • 4diac - test is separate FB
Block Examples
coming soon

Examples 

Mapping (coming in future)


Restart and reorient 2017

After an extremely long break starting / hoping again to use 4DIAC.

This blog is still a good place for documenting not just any progress or experiments, but also details took to do whatever so repeatable. An idea may first appear in an fairly unstructured first exploration post. 


11/26 reoriented and moving on First Goals:

4DIAC-IDE

Installed in C:\Program Files (x86)\4DIAC-IDE_1.8.4_win32.x86_64
Status: 10/24/17 Downloaded, installed, opened
11/15/17 - Patch for spelling clean-up for 4DIAC website. Side track but learning specifics to contribute now like Gerrit and EGit.


Tutorials and Examples

    • Flip-Flop 
      • loca11/8/17
      • distributed 11/20/17 forte/fbrt HMI  11/26/17 RaspberryPi/ fbrt HMI
    • Examples systems
    • X +3 11/17/17
    • Boiler
      • 11/17 unknown types when download. Need to import or real problem?
    • Mech Press - PC 
      • 11/17 unknown types when download. Need to import or real problem?
    • Trafic - Beagle Bone Black
      • Will consider doing something similar on RPi
FORTE supported HW

1. Simulated on PC

2. Lego EV3 10/28-29 installed EV3DEV version of Debian (jessica) Raspbian

ev3dev Debian based  
Follow excellent directions here: http://www.ev3dev.org
  • Status 
    • 10/28/17: installed on SD card and booted
    • 10/29/17 Network connection and ssh
3. Raspberry Pi
Status: 11/13 Raspbian(Stretch) on RPi3 installed.
11/26 Ran distributed apps with PC HMI (FBRT) caused led to blink on Raspberry Pi and simulated LED on PC to blink in sync.
Side Projects [have own post]

1. Compare Lego EV3 programming blocks apps from National Instruments (IEC 61311 based)  to 4DIAC apps and IEC61499 FBs 
2. Find/evaluate Construction and app ideas suitable for education apps

Wednesday, July 24, 2013

July 25 Working inside Haiku LMS

Currently working inside the course in Haiku LMS to verify and document the install for devices the course will support.  Want installs to be smooth and hopefully fast. Here is a screen shot of Devices overview page.

CBCv2 is expected to be the first device fully supported and documented in the course.


Friday, July 5, 2013

July 5 LMS Flashing and drivers

Normally when NXT acts odd, reflash firmware and all is fine. But what can be done with the device not recognized and comes up as Unknown Device / faulty device? This post document the symptons and a simple solution that worked.

I use my NXT with various software and firmware for teaching children NXT Mindstorms (waterbotics) and Lejos, Enchanting, a Scratch like puzzle language, as well as ecos with Forte for this project to teach industrial automation.

Last week my NXT got confused and would not let programs to be downloaded. Finally decided to reflash the firmware.

NXT Mindstorms software normally recognizes an NXT even if other firmware is loaded or in reset mode. It didn't.

Device driver listed as Unknown device, even on my laptop with Atmel driver and SAM-BA.

Tested my set-up with another NXT and the driver showed up, both for Lego and in reset mode.

Somehow connecting a working NXT, fixed the general driver problem. Afterwards the faulty NXT was recognized as a known device, so flashing was easy. In this case the Mindstorms firmware renamed from .rfx to .bin, since was on my development laptop, but its summer workshop time. 

Back to LMS forte next week.


Wednesday, June 26, 2013

June 26 Multiple constructions with 1 NXT

What if a student wants to do have stations, but only has 1 NXT? For example where 1 robot does something and another to delivers or picks-up the material or product.

Background: The IEC 61499 tutorial assumes users have access to popular Lego NXT set. Some may be able to work in teams using multiple NXT sets together or with another device (RaspberryPi or CBCv2) so -between communication between devices can be used. 

But what if alone with just 1 NXT?
So here are suggestions for mini-robots to get the most out of 1 NXT set.

For example a windmill that grinds grain.  The Stomper alone could be used to create a Press example. Sensors are not included here, but can easily be added to control via sensor state.

Additionally a 1 motor robot (forwards/backwards only) to deliver or pick-up a product. Note the cable can interfere with how well the car goes straight forward and back to the same place.
This windmill is a combination Clinton Blackmore's Windmill and Stomper constructions.

Mini-car should be able to be constructed just from these pictures.
1 Motor Mini-Robot Car
Mini-Robot Car parts
See simple Building Ideas by Clinton Blackmore for these and other simple constructions to build on.

Saturday, June 15, 2013

June 15 RPi as BrickPi

Let's combine using Lego Mindstorms (LMS) and Raspberry Pi for hardware option for running IEC61499.

See this Kickstarter campaign for the BrickPi!   which is 60x over its goal. Still 1 day to go.

There are also instructions online to build your own BrickPi via open Hardware (links on right)
Judging from the backing this will be popular very quick.

For the tutorial it would allow those already with popular Lego Mindstorms and low-price popular Raspberry Pi and low cost BrickPi board use.

Best to use another board to run motors with RPi, so why not BrickPi and use Lego NXT motors and also get use of the Lego sensors.

Side Note: CBCv2 has been supported in release version of 4DIAC since Sept. 2012.
The CBC motors and sensors if available also work well with RPi !


Sunday, June 9, 2013

June 6 ARM7 compilers

[Back to LMS=Lego(TM) Mindstorms (TM) NXT with ARM7 inside]

We have been and currently are still using the GNU ARM toolchain with OpenOCD. (see other posts)
For a long time we have looked at other compilers to see if it would help make the FORTE footprint smaller. Especially looking for a way to try using thumb instructions.  Various tries did not work. ARM GNU looks like they have a now have t-arm-elf version.

This post will be used to document what we find out.

For a start a link collection:




Tuesday, May 28, 2013

May 28 Loopback adapter now


Using loopback adapter fixed some firewall issues in the past so install loopback adapter and will see if helps with RPi firewall issues.

Setting up loop back device with Windows 7...
Similar but slightly different to: Mar.15 Setting uploop back device post
  • Open Device Manager 
  • Right click on computer name
  • chose add legacy hardware
  • Next
  • Chose add manually
  • Chose Network adapters
  • Chose Microsoft and Loopback adapter

Tuesday, April 30, 2013

Apr. RPi+forte

A first apps using RPi work using wiringPi interface with forte.
This should help Arduino community get onboard faster.

Update (again): wiringPi is under LGPL . 4DIAC under EPL. Told "as long as you only link against an dynamic library (.so) and don't copy their code (i.e., only use their headers) it should be ok."

Picture will be added... doing more testing and working on course. Video in next post.
[Using breadboard with 220 Ohm resistors and 8 LEDs, usually red]


System model
Note: IP address is LAN IP address of the device.


Tired of blinky... here is an app to test LED on various RPi Pins:



Thursday, April 4, 2013

Apr.4 4DIAC Communication

The 4DIAC-IDE downloads the FBs to the device to start the application.
However Java does run will on RPi so downloading from Laptop using Publish/Subscribe.
First  simple test is X+3 TestApplication distributed with 4DIAC via the workspace.

[NEXT: DIO (digital input/output) SIFB for RPi]

X+3 TestApplication 

Distributed with 4DIAC via the workspace
2 Devices: 
PC for VISualisation; 
MICROCONTROLLER to do the CALCulation remotely.
  1. Laptop displays Input / Output in frame via FBDK
  2. Request published to RPi Subscribe
  3. RPI will do the calculation of X+3
  4. Result published to Laptop Subscribe
  5. Laptop displays result

ApplicationTest as-is assumes the same computer is used for both devices.
Want two physically different devices on a LAN: Laptop and RaspberryPi
System Configuration with Devices
[Update: using 224.x.x.x IP address was needed due firewall restrictions, 
regular LAN device IP address will normally work fine.] Broadcast IP address 224.0.1.1: worked for both Publish and Subscribe to RPi.
IP address use must be included in class.  (typo for MICROCONTROLLER corrected 4/5 2:30PM in Vienna)
Test Results with various Publish/Subscribe Broadcast IP addresses




Multicast References: 

Mar.27+ RPi LED SIFB

Update 4/4/12 

  • wiringPi code example for a blinky works.
  • Code used in a DIO (Digital Input/Output) SIFB compiles.
    • Publish/Subscribe problem currently. See next Post for details.
  • Neil Higgins got a Blinky from forte working! 
    • See 4DIAC / FORTE on Rasperry Pi in 4DIAC Open Discussion
    • Our set-ups are different, so both will be instructional.
      • not using wiringPi,
      • uses Gertboard
Mar.27+ Notes

  • RPi Cross compile - hello world
    • dev environment and cross-compiler install
    • Eclipse properities set-up 
      • See notes at bottom of post
    • communication set-up for testing (TODO)
  • Blinking an LED with C
    • Install of WiringPi (includes git-core)
      • Install and build on RPi
      • Install only on cross-compile computer
        • Need for includes for compiles
        • Copy the installed wiringPi from RPi to cross-compile computer (TODO)
Notes:
Blinking an LED with C - cross compile with wiringPi
http://hertaville.com/2012/09/28/development-environment-raspberry-pi-cross-compiler/
see Stephan questions and answers


RPi Cross-compilearm-linux-gnueabihf-g++

Development Environment for the Raspberry Pi using a Cross Compiling Toolchain and Eclipse Posted on September 28, 2012 by halherta

For Eclipse properties C/C++ General -> Paths and Symbols set-up I found it useful (for copy/paste) to list the files needed :
Includes
$HOME/raspberrypi/tools/arm-bcm2708/gcc-linaro-arm-gnueabihf-raspbian/
1 arm-linux-guneabihf/include
2 arm-linux-guneabihf/libc/usr/include
3 lib/arm-linux-guneabihf/4.7.2/include-fixed
4 lib/arm-linux-guneabihf/4.7.2/include
5 lib/arm-linux-guneabihf/4.7.2/finclude


Library paths
$HOME/raspberrypi/tools/arm-bcm2708/gcc-linaro-arm-gnueabihf-raspbian/
1 arm-linux-guneabihf/lib
2 arm-linux-guneabihf/libc/lib
3 arm-linux-guneabihf/libc/lib/arm-linux-guneabihf
4 lib/gcc/arm-linux-guneabihf/4.7.2
5 libexec/gcc/arm-linux-guneabihf/4.7.2


Wednesday, March 20, 2013

Mar.18-20 RPi + 4DIAC proof of concept

My first 4DIAC RPi tests 

At least 3 others have used RPi with forte already. See forums. I had it easier. Now the Raspian packages are very current.  Traveling next week and have to get my own breadboard and couple other things. But can have software and apps ready to go. No RPi FBs in 4DIAC, but the FB interface for some would be similar to Lego Mindstorms (LMS) and CBC v2 FBs.  

Also I hope to use CBCv2 sensors and small motors with RPi.

Compiled 4diac on RPi. Needed to install more software that were current and instated the first time. Minor problem in 4DIAC development encouraged me to move from default tip to 1.3.1 

Tested using a cross-compiler with Eclipse under Ubuntu.

So far everything seems very straight forward with the RPi
All parts for a proof concept work as 4diac on posix is expected to.

Link collection: [some good, some random]

Control LED by GPIO  on RPi