Category Archives: Project

Creating a Storybot

Testing Storybot output on a regular USB printer

Work has begun to create a robot for dispensing short stories at the touch of a button for Writers Week in 2020. The Storybot will be located in one of the Port Adelaide Enfield libraries and will print from it’s collection of pre-curated stories onto paper via a thermal printer for library patrons to take away with them.

Design

The initial design of the Storybot uses the following parts:

  • Raspberry Pi 4, with MicroSD card
  • Thermal Receipt Printer, USB (24V)
  • Button, resistor (220 Ohm) and connecting wire
  • Power supply (for Rasperry Pi and Printer)
  • Enclosure and stand

Intial print testing was done with a regular Canon USB Pixma printer.

Software

A repository of the code created for the Storybot can be found on GitHub. This repository ‘storybot’ is cloned directly into a subdirectory of the ‘pi’ user (in our case we are using ‘Document/git’).

The Raspberry Pi used has the most recent Raspbian installed which has been updated to the latest packages.

In addition, the CUPS Printing package has been installed, which allows Raspberry Pi to print to any of the supported printers including the receipt format thermal printer. This printer prints 40 column per row with a fixed width.

A quick solution[1] for selecting a random story used the ‘fortune‘[2] package.

Stories are copied to a directory on the Raspberry Pi as individual ASCII text files. Some example files have been created for testing purposes[3]. A global data file and index is created from these files, while also reformatting them for a 40 character line length. Fortune reads these files, and will extract a story and print it.

Story management is driven by a global Makefile with the following targets:

    make help    - this message (default)
make story - display a story
make prepare - compile the stories into data file
(This will be run automatically, if required.)
make list - list story files
make clean - reset system by removing generated files
make status - display system status

This system allows dependencies to be managed, so that ‘make prepare’ would be run if it is required and hasn’t yet been run, before ‘make story’. This allows new story uploads to be done even while the system may be printing.

Printing is done by sending (piping) the story output directly to the default printer with

    make story | lpr
Adding a button

To detect a button press, where a button has been wired up to a GPIO pin, there are several options available. These still need to be investigated, but they include:  Node-RED, WiringPi (C code and used in a previous project) or RPi.GPIO (Python)

  • Node-RED: This is a large-ish application, but it works well and does not require any addional configuration on system start-up and shut-down.
  • WiringPi: This C/C++library is useful for creating lightweight binary programs, but requires additional configuration to enable the created files to restart on reboot/startup. It is no longer being activity supported by it’s developer, but is open source software.
  • RPi.GPIO: Python library that together with Python makes writing scripts that interact with the GPIO on the RasberryPi very easy.

Each of these approaches will need to take care of button bounce/noisy inputs, and stop multiple press events happening in a short period. Some hardware conditioning may also be necessary.

Notes:
[1] Very quick. There are no options for recording any statistics about which stories are printed, or when, which might be a useful thing to record and report on.
[2] The fortune package has a very long history, originally appearing in very early editions of UNIX operating systems.
[3] Stories fro testing were created from the inital paragraphs from “The Princess Bride”, “War and Peace” and “A Tale of Two Cities”.

IoT Workshop (Part 4)

In the last part of this blog post series, we look at pulling everything together with InfluxDB and Grafana to store and display outr IoT sensor data.

Tools to Collect and Display Data

In the workshop we are using the following software tools for processing our collected data.

  • Node-RED – Receive, Process and Push IoT sensor data
  • InfluxDB – Store the time series of sensor data
  • Grafana – Display and manipulate the data visualisation

These packages can easily be installed on a Ubuntu system (desktop or laptop) as well as Raspberry Pi Raspian system[1]. In the following I have included the instructions for installing on Ubuntu.

This combination of software will allow data to be displayed is graphs which can be interactively arranged and manipulated, and shared with multiple users on your network.

Node-RED

The installation and configuration of Node-RED was discussed in the previous post. An additional module needs to be install to allow Node-RED to send data to InfluxDB.

node-red-contrib-influxdb

InfluxDB

InfluxBD is a time series data store, which is like a database, but different. It is designed for storing and retrieving sequential data which contains timestamps in a more efficient way. 

To install 

$ sudo apt install influxdb influxdb-client

It uses the default port of 8086.

Before we are able to start storing data, a database needs to be created in InfluxDB, which we can then push our time series data into. This is done from the Linux commad line ($) as follows: First open a influx prompt (>), then create the ‘iot’ database.

$ influx -precision rfc3339
> create database iot

From the influx prompt (>) you can find out more about the available databases

> show databases

Node-RED can then be configured to push data to this database with the InfluxDB output node, configured as follows.

Configuring InfluxDB node to write to local InfluxDB instance.

A flow can then be configured to pull the data from a Node-RED message and send it to the InfluxDB.

The function used to extract moisture data (analog to digital data in the range 0-1023) is as follows. An additional format check (message starts with “Sensor”) has been added in case some other format is received. The device (device_id) that is reporting the data is specified in the ‘msg.measurement’ field.

var payload = msg.payload.payload_fields.receivedString
var dev_id = msg.payload.dev_id
var re = /^Sensor/;
var moisture = 0.0;
if(re.test(payload)){
payload = payload.substring(10)
var integer = parseInt(payload,16)
moisture = integer/1024.0 * 100.0
}
msg.measurement = dev_id
msg.payload = moisture
return msg;

Grafana

Grafana is a graphing and visualisation package. It can display the information from InfluxDB[3] and display it.

To install[4]

sudo add-apt-repository "deb https://packages.grafana.com/oss/deb stable main"
wget -q -O - https://packages.grafana.com/gpg.key | sudo apt-key add -
sudo apt update
sudo apt install grafana
sudo /bin/systemctl daemon-reload
sudo /bin/systemctl enable grafana-server
sudo /bin/systemctl start grafana-server

Connect to the Grafana server with the URL

http://localhost:3000

When logging in for the first time, you can use any username and password and you will be then prompted to change it.

Grafana is a very powerful piece of software but does a good job of helping the first time user through the initial setup. It is recommended that you have a read through the Getting Started documentation. The following is a very brief summary of the confugration process, and I have glossed over a lot of the details.

Once you login in, you will then be prompted for a data source. The details to connect to the local InfluxDB is as follows. Click and set the URL to http://localhost:8086 (it may just be displayed in grey which is a trap). There is no username or password needed if InfluxDB is installed as mentioned above.[5]

Grafana data query builder.

Grafana plots are configured by specifying a data query. In this case we are looking for data from the ‘iot-workshop-1’ device.

The following resulting plot came from defining two data queries for two IoT devices. The second one was configured to generate random data at 10 second intervals for testing purposes.

Notes:
[1] See: http://blog.centurio.net/2018/10/28/howto-install-influxdb-and-grafana-on-a-raspberry-pi-3/
[2] NodeRED is a general purpose automation framework and can do a lot more than mentioned here.
[3] As well as several other databases, including MySQL and PostgreSQL.
[4] See: https://grafana.com/docs/installation/debian/
[5] You realise that this this needs to be changed if your system is being run on a Internet accessible server, right?

Summary

This series of posts covered the process of building a private IoT platform for collecting and displaying sensor information that uses the Internet to move data about but does not rely on cloud or other 3rd party hosted services other than The Things Network.

There are no ongoing charges or fees with this system, and it is a good introduction to software which can then be adapated for other purposes. Have a look for YouTube videos on how to connect Node-RED to home management systems (Google Assistant or Amazon’s Echo) or create different dashboards with Grafana plugins

IoT Workshop (Part 3)

In the first session of the IoT workshop we presented a general introduction to the LoRaWAN IoT radio and The Things Network. In the second session we looked in more detail at getting an Arduino powered node connected to The Things Network and transmitting data packets.

In the third session, we are taking the data and looking at how it can be processed, in this case using the NodeRed tool.

Installation of Node-RED

Node-RED is a web server program which uses Node.js, which can be installed on a home computer, server, Raspberry Pi or in the Cloud. It can be used to collect and process the data collected by The Things Network[1].) We will be using MQTT to get access sensor data.

For supported Operating Systems and installation instructions, see: https://nodered.org/docs/getting-started/

On Linux Operating Systems (Ubuntu, Debian, Endebian etc.), Node-RED can be installed with

bash <(curl -sL https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered)

sudo systemctl enable nodered.service

It also appears to be installable on Windows 10 using the Windows Subsystem for Linux (WSL)[2].

Once installed, ot can be accessed via web browser connecting to port 1880. If it is installed on the local computer, ot can be accessed by visiting the URL – http://localhost:1880/

A User Guide with Tutorials are available from the Node-RED website[3]. If you have access to a working Node-RED server then the Tutorials are a good way to get started.

One final note. Flows are stored on the computer under the computers name (hostname). It that is ever changed, then the flows will not be loaded and it will look like your configuration has dissapeared. It is still there, and will reappear if the hostname is changed back. The easiest way to fix this is to export your flows to a file first (json) and then import them afterwards. This option is under the main menu.

Notes:
[1] Node-RED is a general purpose automation framework and can do a lot more than mentioned here,
[2] https://schellingerhout.github.io/bash%20on%20ubuntu%20on%20windows/nodered-windows/
[2] https://nodered.org/docs/

Working with Node-RED

Once Node-RED has been installed it can be accessed via port 1880.

Some additional packages are required. These are installed via the Manage Palette menu.

node-red-contrib-persist
node-red-dashboard

Configuration is done by connecting processing nodes with virtual wires to create flows. This allows messages to be processed as they pass through the system.

A Node-RED flow configured to process IoT data.

Data collected by The Things Network is pulled into Node-RED by using the MQTT node. This requires the name of The Things Network application and an application key/password.

Add an MQTT node and add a new mqtt-broker (server)

  • Name: Something memorable eg. Meshed
  • Connection
    • Server: thethings.meshed.com.au
    • Port: 1883
    • SSL/TLS: (Unchecked)
    • Use Legacy MQTT 3.1 support: (Checked)
  • Security
    • Username: enfieldlibrary_iot_trial
    • Password: (application-key copied from TTN website, starts with ‘ttn-account-v2’)

The topic is the MQTT channel to subscribe to where ‘+’ is a wildcard and will match any device name.

enfieldlibrary_iot_trial/devices/+/up

There are a range of channels defined in the The Things Network API[1] covering different types of messages. Eg. up, down.

Node Decription

MQTT client

This node connects to The Things Network and subscribes to the defined topic. Any data sent by our LoRaWAN devices will be sent out this node.

JSON

This node converts a text payload to JSON format. This is useful for allow later nodes to access individual parts of the payload.

Switch

Diverts messages between different  processing flows. In the above flow, it is being used to send device data to different dashboard labels. This allows us to display the latest data coming from each sensor.


Function

Code can be written in JavaScript to manipulate the messages passed to the node.

In our example we take the data transmitted by our device and received by The Things Network (eg. Sensor: 0x0267)[2], extract the data (substring) and convert to a meaningful number (moisture). This is passed directly to the next node in the payload of the message (the ‘msg’ variable).

var payload = msg.payload.payload_fields.receivedString
payload = payload.substring(10)
var integer = parseInt(payload,16)
var moisture = integer/1024.0 * 100.0
msg.payload = moisture

// To allow plotting of multiple series
msg.label = "sensor-1"

return msg;

Dashboard Label

Creates label elements to display on the dashboard. These are updated by messages.

Dashboard Graph

Displays a graph from data. By default, the data is not permanantly stored and will not persist between flow deployments. The graph data can be stored persistantly by including save and restore nodes.

Persist (Save Data / Restore Data)

These nodes are used to ensure that the graphed data is persistent between reboots. Under particular conditions the date is written to a non-volatile location, and is read back into the system when starting up.

Multiple sets of data can be saved, but the save and restore nodes need to match.

Notes:
[1] https://www.thethingsnetwork.org/docs/applications/mqtt/api.html
[2] For the workshop there was a deliberate choise made to use ASCII strings to encode the data. This is inefficient, but allows the data to be easily viewed for training and debugging purposes. Have a look at Cayenne Low Power Payload (Cayenne LPP) for one encoding method to improve this.

Summary

The nodes above can be used in Node-RED to receive, display, graph and store data from LoRaWAN enabled sensors. It is a general purpose system and as such is missing some of the whistles and bells of some other systems.

Improvements can be made by hooking in some additional software packages. In particular, data can be stored in a database specifically designed to hold time series of sensor data (eg. InfluxDB[1]) and a more functional dashboard can be added for better graphing and analysis (eg. Grafana[2]).

Notes:
[1] https://www.influxdata.com/
[2] https://grafana.com/

IoT Workshop (Part 2)

In the previous post we discussed the LoRaWAN network and gave an overview of how it works end to end. This post looks in more detail and describes what’s necessary to get data into the network from individual sensors.

The LoRa Radio and LoRaWAN

The LoRa radio module transmits in the Industrial , Scientific and Medical (ISM) unlicensed radio band[1]. In Australia (and New Zealand) LoRa transmits between 915-928 MHz[2]. For uploading data, the band is divided into 64 narrow bandwidth channels of 125 kHz, with an additional 8 overlapping broader channels of 500 kHz.

The data is encoded using a chirp signal. The rate that this frequency changes is defined by a ‘spreading factor’ (SF), and a doubling of the spreading factor approximately doubles the amount of time it take to transmit data[3].

LoRaWAN Channel Allocation for Australia and New Zealand

Notes:
[1] ISM Band – https://en.wikipedia.org/wiki/ISM_band
[2] https://lora-alliance.org/sites/default/files/2018-05/lorawan_regional_parameters_v1.0.2_final_1944_1.pdf
[3] https://medium.com/home-wireless/testing-lora-radios-with-the-limesdr-mini-part-2-37fa481217ff

Hardware

Dragino Arduino Shield

To use LoRa and LoRaWAN we are using the following LoRaWAN Arduino Shield available from the local suppliers. It is supplied to transmit and receive in the 915 MHz. As purchased the jumpers were not set, and needed to be installed as indicated in the picture below.

When developing hardware, it is only possible to use digital input/outputs 3,4 and 5 (3 lines). Digital IO 0 and 1 are used by serial IO and interfere with programmng. The digital lines D11-13 are used to control the LoRa radio.

The available Arduino pins for projects are

  • D3-5 (3 digital lines) – Can be sed for Digital IO
  • D0-1 (2 digital lines) – Can be used for Digital IO but interferes with in circuit programming. Needs to be disconnected first.
  • A0-5 – Canbe used for Analog Input or Digital IO
  • SCL,SDA – Can be used for Digital IO and Analog In on Arduni Uno.
  • AREF – Used as analog reference voltage
  • GND – Ground

Software

Arduino Library for LoRaWAN (LMIC)

The Arduino LMIC library that we are using is being maintained by Thomas Laurenson and can be found on Github[1]. The original LMIC Library was written by IBM and has been ported for use with the Arduino board.

Once downloaded and installed in the Ardiuino IDE library directory[2], the software needs to be configured to use the Australian frequency plan which is done by editing the file ‘project_config/lmic_project_config.h’. For some reason the Australian configuration is called CFG_au921.

// project-specific definitions
//#define CFG_eu868 1
//#define CFG_us915 1
define CFG_au921 1
//#define CFG_as923 1
// #define LMIC_COUNTRY_CODE LMIC_COUNTRY_CODE_JP       /* for s923-JP */
//#define CFG_in866 1
define CFG_sx1276_radio 1
//#define LMIC_USE_INTERRUPTS

Notes:
[1] Github: https://github.com/thomaslaurenson/arduino-lmic
[2] When unzipping the software, there may be duplicated recursive top level directory names (eg. arduino-lmic/arduino-lmic). Ensure that only one level is copied into Arduino library folder.

Example Arduino Sketch

An example Arduino sketch also available from the GitHub repository, which can be used to connect to the LoRaWAN network. See arduino-lmic/examples/ttn-otaa-dragino-lorashield-au915[1].

When connecting to the LoRaWAN network there are two authentication methods “Authtication by Personalisation” (ABP) and “Over the Air Authentication” (OTAA). While it is a little more complicated, OTAA is preferred as it allows the network more control over the authentication process, but requires two-way communication with the end-node. ABP does not require the end-node to receive data from the network but the network needs to know when the end-node is ever reset[2].

For OTAA, there are three pieces of data that need to be copied into the sketch, and are obtained from The Things Network console[3].

  • Device EUI (DEVEUI) – This is the unique identifier for this device on the network. This can be changed. This needs to be used in the sketch in Least Significant Byte (lsb) order.
  • Application EUI – This is the application identifier, and is unique across the LoRAWAN network. This needs to be used in the sketch in Least Significant Byte (lsb) order.
  • Application Key – This is an initial encryption key shared between the Node and Application. It can be changed. This needs to be used in sketch in Most Significant Byte (msb) order.

The webpage tries to make this as easy as possible by allowing you to adjust the formatting and the copy to clipboard button.

Device confiuration parameters in The Things Network

These details are copied into the Arduino sketch in the FILLMEIN locations as shown below.

// This EUI must be in little-endian format, so least-significant-byte 
// first. When copying an EUI from ttnctl output, this means to reverse
// the bytes. For TTN issued EUIs the last bytes should be 0xD5, 0xB3,
// 0x70.
static const u1_t PROGMEM APPEUI[8]= { FILLMEIN };
void os_getArtEui (u1_t* buf) { memcpy_P(buf, APPEUI, 8);}

// This should also be in little endian format, see above.
static const u1_t PROGMEM DEVEUI[8]= { FILLMEIN };
void os_getDevEui (u1_t* buf) { memcpy_P(buf, DEVEUI, 8);

// This key should be in big endian format (or, since it is not really a
// number but a block of memory, endianness does not really apply). In
// practice, a key taken from the TTN console can be copied as-is.
static const u1_t PROGMEM APPKEY[16] = { FILLMEIN };
void os_getDevKey (u1_t* buf) { memcpy_P(buf, APPKEY, 16);}

In the sketch, the following line can also be changed.

static uint8_t mydata[] = "OTAA" 

This is the data that is going to transmitted over the network. This short string can be edited to something more meaningful. The sketch can then be compiled and installed, and if a LoRaWAN Gateway is within range, transmitted data will start to be collected by The Things Network Application.

Notes:
[1] Github: https://github.com/thomaslaurenson/arduino-lmic/tree/master/examples
[2] The packet counters need to be reset. This is used to stop data ‘replay’ attacks.
[3] Console->Applicaion->Devices

LoRaWAN Data

The transmitted packet data will appear under the Application Data on The Things Network.

Data packets being received from an IoT device via LoRaWAN

The information includes the data transmitted by the IoT device and metadata from the network about the transmission. Expanding the packet entry shows this detail.

In the case above, to assist with debugging a custom Payload Format decoder has been added which converts the bytes to a string with can be seen in the ‘receivedString’ field[1].

// Decode an uplink message from a buffer
// (array) of bytes to an object of fields.
function Decoder(bytes, port) {
// var decoded = {};
// if (port === 1) decoded.led = bytes[0];
// return decoded;

// Decode plain text; for testing only
return {
receivedString: String.fromCharCode.apply(null, bytes)
};
}

The raw transmitted data can be seen in the Payload.

The metadata fields show the frequency used (917.8 MHz), the datarate (SF7BW125 – Spreading Factor 7, Bandwidth 125 kHz) and the gateways which heard the transmission and their details.

Notes:
[1] https://core-electronics.com.au/tutorials/encoding-and-decoding-payloads-on-the-things-network.html

Next Time (Part 3)

The next step will be to look at how to make use of the collected data. NodeRed is a software package will be used to process and manipulate the data as it is received.

IoT Workshop

On Thursday (24 Oct 2019) we started running the first session of a new IoT workshop, being held at the local libray (Enfield Branch of the Port Adelaide Enfield Council). This workshop aims to be an introduction to creating sensors and nodes for the LoRaWAN IoT network, using The Things Network website.

This first sesssion (of four) was a whirlwind dump of details which we will unpack and work on through the remainder of the sessions, with hands on electroncs and programming.

We went though the architecture of the system and got everyone to create an account on The Things Network, and set them up so that they could see the IoT data that was being transmitted over the network.

Architecture of LoRAWAN Network (from The Things Network)

Technolgy discussed..

A quick summary of the various bits-n-pieces that are being used follows.

LoRa

The radio technology that is used by sensors for ‘Long Range’, low bandwidth communication. These radios may be programmed to be used in either point-to-point or point-to-gateway (LoRaWAN) mode, configurable with software. They use the unlicensed ISM radio bands, 911MHz in Australia.

https://en.wikipedia.org/wiki/LoRa

LoRaWAN

The radio network and infrastructure used to collect sensor data, via publically accessible gateways.

Arduino

A microprocessor board and programming tools, which use the Atmel (and other) microprocessor. The original aim was to create a programming system which was easy to use for hobbyists and members of the maker community. Arduino microprocessor boards can be used with a LoRa radio to create sensors which can transmit data via LoRAWAN and the internet to be collected and used by other applications. https://www.arduino.cc/

Arduino Shield

This is additional hardware that has been designed to plug directly into an Arduino board and allow it to be easy to use.

Arduino IDE

The Interactive Development Environment (IDE) used to program an Arduino microprocessor board. It is available as a downloadable Java program, and as a web based application. The software is available from the Arduino website.

Arduino Libraries

Additional software packages which can be installed to extend Arduino programs. For example, the LMIC library is used to allow our Arduino programs to use the LoRaWAN radio shield.  

Libraries can be downloaded from within the Arduino IDE, or downloaded and installed manually.

LoRaWAN Sensor Node

A device which collects data and transmits to the LoRaWAN network. It uses a LoRa radio. They need to be registered and authenticated with the LoRaWAN network to transmit correctly.

LoRaWAN Gateway

A device which listens for LoRaWAN radio transmissions from nodes in its area and forwards them to the servers on the LoRaWAN network. They need to be connected to the internet and be registered to operate.

The Things Network

A free website (registration required) which allows access to data collected by LoRaWAN sensors. It is used to register LoRaWAN gateways on the network, and create LoRaWAN applications.

https://www.thethingsnetwork.org/

MQTT

MQ Telemetry Transport. This is the communication software and protocol  used to allow sensor data to be distributed and used once it has been collected by The Things Network.

NodeRed

A web server program, which can be installed on a home computer or server (or Raspberry Pi) which can collect and use sensor data collected. It uses MQTT to access sensor data.

NodeRed is an automation environment and is useful for a lot more than collecting and displaying our IoT data. See the website for more details.

https://nodered.org/

TTNmapper

Mobile application which can be used to map LoRaWAN coverage.  https://ttnmapper.org/

Sensor/Node Example

The following are some example of the sensors that will be built in the workshop.

Moisture Sensor

A soil moisture sensor which sends measurements via LoRaWAN to a monitoring application created NodeRed

The data is displayed in a web browser as the following.

Next Post: IoT Workshop (Part 2)

Building a Junk Rover (Part 2)

Introduction

The Junkbote Rover

In the last article, we posted about how the Junkbot rover was built and what went into its initial construction. Since that post was written, the robot has been completed and it is now does everything it was designed to do and a little bit more.

This article will describe what has been added and changed. It then also discusses what additional things could be added or changed in the future, or included in any new robot projects. (Watch this space!)

The Junkbot appeared at the recent Science Alive 2019, at the Port Adelaide Enfield diplay, and while there, was driven around remotely, making friends with the visitors.

Completing the Build

There have been some minor changes and additionss to the robot as seen in the picture above. Cosmetically, the green button in the middle of his ‘head’ has been replaced with a red numerical display that shows the battery voltage. The black speakers (USB) below this have been replace with a larger box containing USB powered/amplified speakers that take their audio from a line-in (line-out from the Raspberry Pi computer) which are louder and are more reliable. The original USB based audio speakers would periodically just stop working.

On the side of the top grey box, a pair of sero motors have been added, one on each side. The customer will be able to add what every they want to these. These were wired to the Raspberry Pi PWN board, and can be controlled to go up and down independantly.

Driving the Robot

As mentioned in the previous article, the computer controlling the robot is a Raspberry Pi 3, running with a custom Python program which uses keybaord input to then drive the various motors and servos on the robot. The operating system bering used is Raspbian, which has a graphical desktop, similar to MS Windows or Apple iOS, but instead of displaying oit on a screen, can be shown on another computer on the network, via a program called VNC. This easily allows someone sitting at a computer screen, possibly at a long remote distance, to see what the rovers computer sees, and control it in exactly the same way as if they were sitting next to it (as if it had a screen, keyboard and mouse attached).

When running the driving software, pressing keys on the keyboard (‘w’,’a’,’s’ and ‘d’) will make the robot drive forward, left, backwards, and right. Other keys will make it move its servos up and down, as well as completely stop.

Webcam software displays the camera image, so the driver can see where they are going.

In addition, by using some standard video conferencing software (Google) , the robots speakers and microphone can be used to hold conversations with people near the rover. Voice changing software on the call add additonal interest, giving the robot even more personality.

Improvements, Upgrades and Future Plans

The rover uses the Raspberry Pi 3 computer. An immediate improvement to performance, if required, is to upgrade this to a Raspberry Pi 4, with larger memory. The board can be resonably easily swapped out, and running the new board from the existing SDcard.

The Raspbian operating system, which is based on Debian, made the task of developing the driving software, and integrating it with other standard software packages (audio, video, remote desktop etc) very easy to do. Little, if any, changes neede dto be made to get the various software packages to work together. It almost felt like cheating. If there is any other requirement for the rover (eg. adding USB Scanner) then adding this aught to be straight forward, particularly it already exists on a general purpose linux desktop system. Raspian has also been configured to work on the small Raspberry Pi, which avoids a lot of possible finiky problems with system settings that may not be suitable on a resource constrained system.

Much of the other robot software systems out there are specifically written with particular robot hardware platforms in mind, and run on predefined operating systems. An example of a Open Source option is ROS (Robot Operating System and ROS2), but these only run on particular versions of Ubuntu. It would be interesting to use ROS2, as it allows greater flexibility in how the robot can be operated, including tracking and autonomous driving modes, as well as a bunch of other robot options. The learning curve is also quite steep.

Os menioned, the driving softwareis keyboard based. It could be replaced with a graphical tool, maybe also written in Python (Qt4Py). The keyboard events could still be captured and used, but the display could be use to provide more information and create an easier way to operate the rover, An example of this migh tbe a more intuative display of the of motor tuning parameters used to drive of the motors. Getting the rover to drive straight was always little bit tricky.

Along the lines of hardware improvements and additional sensors, shaft rotation sensors could be added to the wheels to get better motion/position sensing, or accellerometer and gyro sensors. It is possible to add an Xbox Kinect sensor bar as a distance sensing camera, which would be useful if driving in an area where people might be moving.

Building a Junk Rover

Another project for 2019! I am helping build robot rover with a “junk” theme (eg.make from e-waste) for use in school education program about recycling and reuse of electronic waste.

This is being done as part of my involvement as a volunteer with Port Adelaide Enfield Libraries and their STEM Program.

Robert has built the hardware which consists of a chassis made of old computer boards. The eyes are recycled IP security cameras which no longer work. The video is coming from a webcam, and the mouth is the usual set of stereo speakers sold for use with the Raspberry Pi computer. To control the motors and other moving parts, the Junkbot uses a small Raspberry Pi computer and a 16 Channel PWM PiHat from Core Electronics.

All of this work has been done with the aim of releasing everything under Free and Open licenses (both hardware designs and software). It would be great if the project reached a point where we not only made something useful for the STEM program but that others could use as a base for their own projects. (If any of this is useful to you, please let me know.)

All of the code from this project is available at Github.

The robot is running ‘Raspbian’ on the Raspberry Pi with the Python Libraries from Core Electronics to enable the wheel motors ans servos to be crontrolled via Pulse Width Modulation (PWM) and the attached PWM board.

For better or worse it was decided to create a keyboard control interface to drive the robot. The desktop screen of the Raspberry Pi is exported over Wifi and the internet via VNC, which can be accessed via VNCviewer. Using keyboard controls we can drive the robot motors, which also allowed us to then tune it’s operation.

As an initial observation, smooth driving operation of the robot might sound like a good idea but it appears as though with remote camera access, control is better if the robot makes small moves, allowing the video display to catch up.

Tuning, modifications and upgrades continue.

More about the construction

From Robert Hart on the electronics…

Inside the head of the Junkbot

The robot will run on a S3 Lipo (on the left in the picture above). Its nominal voltage of 11.1V (3.70V*3 cells) and a fully charged 3S pack is 12.60V and a fully discharged 3S pack is 9.00V. I have incorporated two 5V buck (voltage) convertors: 5A for the Raspberry Pi and 3A for the Servo Hat. The two motors are driven using two Electronic Speed Controllers (ESC)

Waterproof Electronic Speed Controller

The ESCs have had the fans are removed and the on/off switchs have been removed and shorted. The servo lead has also had its postive wire open circuited so not to feed its 5V rail back into the Servo hat.

The Rasperry Pi and Servo Hat can be seen to the right of the box. The ESC’s are above that, with the two voltage converters at the bottom.

Adding a Dev case out of Lego

While the kids had the Lego out, I thought that I would pinch some pieces and build a case for my LoRaWAN node. Nothing fancy, random colours but enought to protect the boards from random knocks and bumps.

Blinking LEDs, improved with Lego
Blinking LEDs, improved with Lego

Technical Specifications

  • Pieces: 55
  • Colour: Various
  • Dimensions: 9 studs x 12 studs x 5.2 layers

Code for Cosmic Array Sensor Project

A recent project has been pulling together some code for a Raspberry Pi Zero, which is going to be part of the system in the a Cosmic Ray Sensor. Details about the The Cosmic Array project, which is part of the Splash Adelaide Winter Festival are available from the Hackaday Website.

The Raspberry Pi takes events from the sensor and plays chimes depending on the direction that the detected muons appear to come from (via a coincidence circuit).

Adelaide Internet of Things (IoT) Hackathon

Yesterday (Sat, 23 April 2016) saw the first Adelaide IoT Hackathon held at the Smart City Studio in the City of Adelaide.

This author is very please to announce that we were successful and won the event with our project: City wide water leakage monitoring. We were us against the 10 Cent – Internet of trash and an Interactive Electronic Notice Board. The decision was very tough according to the judges.

The prizes include access to IBM’s IoT and Cloud platforms. We will be updating the Hackaday page above with more details as we progress with the project.