Support for the Starter Kit in XOD
(Dear Biomakers, we are looking for additional contributions to this section. Please send anything that you think others might find useful to: jh295”at”cam.ac.uk)
The XOD development environment is relatively new, and doesn’t yet have built-in support for as wide range of hardware as the Arduino IDE. However, the level of support is increasing rapidly, and in addition, XOD provides a number of ways for building drivers for new hardware.
The Biomaker Starter Kit includes the Rich UNO R3 microcontroller board (Open-Smart, Shenzhen). The board alone provides a series of input and output devices that can be controlled directly in XOD, and we also provide a kit of separate components that allow expansion of the board. Some tips and examples follow:
The Rich UNO R3 board uses the CH340G USB interface driver chip, which is compatible with Windows, Linux and MAC OS, but is different from that used in the Arduino UNO. A different software driver is required, and information and links for download can be found at https://kig.re/2014/12/31/how-to-use-arduino-nano-mini-pro-with-CH340G-on-mac-osx-yosemite.html.
The manufacturer’s (Chinese language) site is at: http://www.wch.cn/download/ch341ser_mac_zip.html
General “getting started” information at: https://www.arduino.cc/en/Guide/HomePage
Testing the board and connection: There is an onboard LED that can be used to provide a visible output. It is positioned adjacent to the power LED (between the USB connector and 4-digit display), and connected to output D13. The LED node can be used in a XOD patch to control the flashing of this LED - as a simple test to check setup of the board and software.
Touch buttons for user input: The Rich UNO R3 board has four touch sensitive pads that behave as switches. They are labelled TCH1-4, and are wired to ports D3-D6. The switches are normally fixed at a high logic level, and drop to low when touched. The Button node in XOD includes debouncing of key-switching, and can be used to detect user input. The output can be inverted using a Not node, if required - and used to trigger or control other events.
Buzzer: A piezo-electric buzzer is connected to output D9, and this can be driven to create an audible warning. The flip-n-times node can be used to generate a repeating alert.
Real Time Clock (RTC): The board has a built-in clock and back-up battery. This is based on a DS1307 high-precision real-time clock module with I2C serial interface, and address of 68h. XOD provides direct support for this type of chip, and nodes and examples are provided for (i) setting the time, (ii) reading the time, and (iii) formating the year, month, day, date, hour, minute and second for processing or display.
Temperature sensor: An LM75 temperature sensor is mounted on the board. The microcontroller communicates with it via an I2C interface, at the address 48h. The temperature sensor is internally calibrated and measures to ~0.1 degree C accuracy. The temperature is output as a number that can be operated on or displayed. The LM75a-temp-sensor node can be found in the gst/lm75atempsensor XOD library - and allows simple access to the on-board sensor.
Shield expansion: The board contains sockets for mounting standard Arduino UNO shields. This allows simple expansion of the board functions. Note also that the microcontroller ports are connected to on-board devices via a bank of DIP switches. This allows existing functions to be switched off, to avoid conflict with new connected devices. The kit of components provided in the Starter Kit include an IO Expansion Shield. This can be plugged in to simplify the connection of new hardware devices.
16x2 LCD display: The component pack contains a liquid crystal display capable of displaying 2 lines of 16 characters. The device is equipped with an I2C interface, that allows serial communication with the device. XOD contains the node text-lcd-16x2-i2c, that allows direct communication with the display, with inputs for each line of the display. The address of the I2C device should be set at 38h. The text display can be a very useful tool for following programmes’ behaviour. In addition, XOD provides the watch node, a number of which can be connected to the outputs of key nodes, and provide real-time output of values as a programme is run in debug mode.
4 digit 7-seg display: