Tutorial 3: Using extension shields
Objectives: (i) Plug in the expansion shield provided in the Biomaker starter kit, (ii) Connect an external 16x2 LCD text display, (iii) Drive the text display from within XOD, (iv) Introduction to Arduino-compatible multifunction shields.
Requirements: Computer loaded with XOD and board driver, Rich UNO R3 board, expansion shield and RGB LCD device from Biomaker starter kit.
Step 1: Plug in expansion shield
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.
Step 2: Connect the 16x2 LCD display
The component pack contains a liquid crystal display (LCD) capable of displaying 2 lines of 16 characters. The device is equipped with an I2C interface, that allows serial communication with the device. The hardware device is connected to a 4-wire I2C port, being sure to correctly connect the Vcc, Gnd, SDA (data) and SCL (clock) wires. XOD provides the software 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 using the ADDR parameter. 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.
Step 3: Step up communication with the I2C display in XOD
A potentiometer is provided on the Rich UNO R3 board, connected to port A3. The pot node can be set to this port and provide a user-generated variable signal for input to other nodes. Here is can be used to provide a signal for display on the LCD display. The output of the pot node can be fed to a format-number node. This allows the user to set the number of significant digits, and convert the numerical value to a string for display on the LCD. The text-lcd-16x2-i2c node provides inputs for the two lines of display (L1 and L2), with up to 16 characters allowed for each line. A text-node can be used to provide a fixed text string as a label for the other line of the display.