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