B4R Tutorial B4R Experiments

Discussion in 'B4R Tutorials' started by rwblinn, Jul 8, 2016.

  1. rwblinn

    rwblinn Well-Known Member Licensed User

    Hi,

    whilst exploring B4R (as a hobbyist), build experiments and published those on my website in several categories. The experiments also show B4X integration examples.
    A few experiments to mention:

    Change Log
    2017-11-16: (Post #12) L9110 DC Motor Control (B4R,B4J,Node-RED)
    2017-11-12: (Post #11) Remote controlled battery powered motorized locomotive Duplo train track with ABMaterial Client
    2017-11-09: (Post #10) Remote controlled battery powered motorized locomotive Duplo train track
    2017-10-23: (Post #9) Servo Motor Duplo Train Track Switcher 6379 (Serial,B4R,Node-RED)
    2017-10-14: (Post #6) Servo Motor Duplo Train Track Switcher 3775 (Serial,B4R,Node-RED)
    2017-01-04: (Post #5) ESP8266 to Node-RED using UDP, Make: Project numberX.
    2016-12-12: (Post #4) Arduino to Node-RED.
    2016-12-07: (Post #3) DHT11 MQTT
    2016-07-11: (Post#2) ESP8266: LED Blink, LED Control [MQTT,Node-RED,Raspberry Pi], Servo Control [MQTT,Node-RED,Raspberry Pi]

    Enjoy
     
    Last edited: Nov 16, 2017
  2. rwblinn

    rwblinn Well-Known Member Licensed User

    Update Jul 11, 2016
    • ESP8266: LED Blink, LED Control [MQTT,Node-RED,Raspberry Pi], Servo Control [MQTT,Node-RED,Raspberry Pi]
    Notes
    Started to explore Node-RED, IBM browser-based visual tool for IoT programming. It runs on the Raspberry Pi OS Raspian (Jessie) latest versions (documentation).
    In addition, installed the Node-RED addon node-red-contrib-ui, which introduces number of widgets (nodes) enabling rapid dashboard implementation. Nice UIs must say. See below UI screenshots for the 2 experiments mentioned earlier. The labels are the node names (easier for testing), of course this can be changed to more non-technical.
    Communication is handled using MQTT with B4J Non-UI Application MQTT Broker. The Node-RED Nodes for the 2 experiments all use MQTT.
    The first impression of Node-RED is very good = looks promising.

    LED Control Flow + Browser
    upload_2016-7-11_14-31-49.png

    Servo Control Flow + Browser
    upload_2016-7-11_14-31-16.png
     
    Last edited: Jul 11, 2016
  3. rwblinn

    rwblinn Well-Known Member Licensed User

    Update Dec 07, 2016
    • DHT11 MQTT (read, download source B4R, B4J-MQTT-Broker, B4J-UI-MQTT-Client, B4A-MQTT-Client, Node-RED-Flow, Lazarus-MQTT-Client)

    Note
    1) In preparation of a LEGO experiment Weather58, build this experiment to publish, in intervals via MQTT, the temperature (Deg C) and humidity (%RH) of a DHT11 sensor (Sunfounder) connected to an ESP8266 (WeMOS D1). The ESP8266 is connected to a WiFi Network and a Raspberry Pi (RPi) USB port (for power supply only). For B4R development, the ESP8266 is connected to a PC.
    This experiment shows in principle publishing and subscribing to MQTT topics using B4R, B4J, B4A and other like Mosquitto, Node-RED and Lazarus. It can be used as a base for other solutions.
    2) Please note that there are several threads about functioning of the rDHT library with all kind of devices. For this experiment the rDHT v2.00 is doing a good job ;)

    upload_2016-12-7_14-14-38.png
     
    Molchyn, pesquera, Erel and 1 other person like this.
  4. rwblinn

    rwblinn Well-Known Member Licensed User

    Update Dec 12, 2016
    • Experiment Arduino to Node-RED (read, download B4R source & Node-RED flow)
    Notes
    • Publish in regular intervals on Node-RED (running on a Raspberry Pi), the temperature (T, Deg C), air pressure (P, mBar), altitude (A, m), polling interval (I, s) and reference altitude (R, m) of a BMP180 sensor connected to an Arduino MEGA. The Arduino is connected via serial line to a Raspberry Pi USB port. Data is send in JSON format and parsed by Node-RED.
    • Open to add more sensors, like photoresistor or to make the Node-RED Dashboard more fancy/longer data storage.
    • Instead of sending a JSON string, there might be better ways like using the B4RSerializer - but found handling JSON in Node-RED is simple.
    upload_2016-12-16_10-23-25.png
     
    Last edited: Dec 16, 2016
    pesquera, Tayfur, Erel and 2 others like this.
  5. rwblinn

    rwblinn Well-Known Member Licensed User

    Update Jan 04, 2017

    • Experiment ESP88266 BMP180 UDP communication to Raspberry Pi Node-RED (see here > B4R Experiments
    • Make: Project numberX (a device to generate and display a random number within a given range)
    Notes
    numberX
    is at prototype stage. The code is ready (B4R 1.8.0), used rLEDControl library for the display. Next step is to build the Lego Case. While developing, new ideas triggered for a next version (potmeter to set the timerinterval, switch to turn the RGBLED off, control via BLE with B4A).


    upload_2017-1-4_10-9-36.png
    Prototyp Arduino MEGA with the 4 pushbuttons to set the random number range. The RGB LED to light green when ready generating or random color while generating. The very right pushbutton to generate the number while holding down. The two time 4digit 7-segment display.
    upload_2017-1-4_10-10-45.png
     
    Last edited: Jan 4, 2017
    inakigarm and Erel like this.
  6. rwblinn

    rwblinn Well-Known Member Licensed User

    Update October 15, 2017

    New experiment Servo Motor Duplo Train Track Switcher (Serial,B4R,Node-RED) published.
    The Duplo Train Track Switcher uses a Servo Motor controlled by an Arduino UNO.
    The solution will be part of a planned Make Project Duplo Train Control.

    Please note, that my website has changed from an own solution using w3.css to a phpBB solution. Makes it much more easier to organize and maintain.
     
    Erel and inakigarm like this.
  7. inakigarm

    inakigarm Well-Known Member Licensed User

    Looks nice !

    Hope you can import the old Web easily (the new search option could be very useful)

    P.d: Have you consider ABMATERIAL for the new Website in front phpBB? (I suppose phpBB have predefined schimes to implement a forum site)
     
    rwblinn likes this.
  8. rwblinn

    rwblinn Well-Known Member Licensed User

    Thanks. The import of the old web site is making good progress - good opportunity to clean up old stuff.

    In phpBB it is possible to define own styles - a great example is the Raspberry Pi Forum site.

    Initially had been thinking of using ABMaterial as a complete solution (it is a great B4J AddOn), but (my opinion) the effort for learning, designing and maintenance is rather high compared to the off the shelve package I selected ... although with ABMaterial nicer look-and-feel sites can be build ... but that was not my intention.

    My hosting provider offers several web apps as part of my package = explored several, like Typo3, WordPress, MediaWiki, CMS, Drupal etc. BUT found phpBB most powerful and easy to use - without the need for a steep learning curve - esp having experience in using forums - phpBB has also good reference sites which I looked up.
    So far, quite happy with phpBB and lets see what the (near) future brings ...
     
    inakigarm likes this.
  9. rwblinn

    rwblinn Well-Known Member Licensed User

    Update October 23, 2017

    Building upon experiment mentioned post #6, created another solution using a different Duplo Track Switcher to include LEDs for the direction.
    See Servo Motor Duplo Train Track Switcher 6379 (Serial,B4R,Node-RED)
    Enhanced controlling via Node-RED. Next is to build a train with a NodeMCU to be controlled either via Node-RED or Android App (B4A) ... also considering ABMaterial as well.

    upload_2017-10-23_11-53-22.png
     
    f0raster0, JordiCP and Erel like this.
  10. rwblinn

    rwblinn Well-Known Member Licensed User

    Update November 9, 2017

    The fun goes on as continued mentioned Post #9 by building the locomotive.
    Read Remote controlled battery powered motorized locomotive running on Duplo train track (B4R, Node-RED). Source code can be downloaded.

    Summary: The locomotive prototype has a ESP8266 Node-MCU with DC Motor, Distance Sensor, LED Headlight, Buzzer and is powered by a B4R program which is remote controlled by Node-RED running on a Raspberry Pi. Communication protocol is MQTT (Mosquitto broker, several clients possible).
    Loco control functions: move forwards/reverse, set break, set speed, set obstacle distance which stops the loco if reached and the beep goes on.
    Notes: Next version, the HC-SR04 will be powered by 5v (more suitable). Will share small video as well. Considering ABMaterial client on Raspberry Pi.

    upload_2017-11-9_10-33-53.png
     
    inakigarm, Erel and klaus like this.
  11. rwblinn

    rwblinn Well-Known Member Licensed User

    Last edited: Nov 12, 2017
    Erel and inakigarm like this.
  12. rwblinn

    rwblinn Well-Known Member Licensed User

    Update November 16, 2017

    L9110 DC Motor Control (B4R,B4J,Node-RED)

    This is an alternative to the previous motor shield solution shared. It uses the cheap L9110 Motor Driver.
    The Arduino UNO runs a B4R program controlled by a B4J Application or Node-RED running on the Raspberry Pi. Communication via the serial line with asyncstreams. Details and download in the link above.

    [​IMG]
    Overview: The Node-RED function nodes are connected to a Serial Out Node (now shown on the picture)
     
    ta1dr, Erel and inakigarm like this.
Loading...