Training Session 1:
Introduction to programming the Arduino micro controller using the XOD visual programming interface.
Monday 11 June, 6pm – 8pm, Postdoc Centre, 16 Mill Lane, Cambridge (Register here)
1. Introduction to hardware
In this first session teams will be introduced to Arduino microcontroller boards. The boards contain a microprocessor with embedded interface circuits, including non-volatile memory. The devices can be powered directly from a USB port, which also allows software running on a laptop to be compiled and then dumped as a single programme (or "sketch") into the microcontroller memory. This is a very simple form of computer, with only one programme and no operating system. For biologists, the process of dumping code into the microcontroller is not so far from the process of constructing a DNA circuit and dumping this into a cell.
Participants in the Biomaker Challenge will be given an UNO Arduino board, and a Gtronics Proto Shield Plus chassis as part of their Starter Kit. The latter allows mounting of the Arduino board and shield (see below), and provides a 2x16 character LCD display, control switches and a plug board for prototyping new circuits. We wish to keep the training sessions open for all interested - and we can loan hardware to folk who are not already Biomakers. In addition, the hardware is relatively inexpensive and is readily available for purchase online.
Background information about Arduino boards can be found online at https://www.arduino.cc
2. Introduction to XOD
XOD is open source software that can be used to programme the Arduino micro controller board. It uses a graphical interface that represents hardware and computing elements as nodes that can be wired together to allow data flow between the objects. We think that this provides a simple way for non-programmers (i.e. biologists) to develop useful skills and understanding - without needing to deal with the complications of programming languages and syntax.
There are variety of introductory lessons for XOD, available at: https://xod.io/docs/tutorial/ - an example is shown right.
Simply install the cross-platform XOD software, assemble and plug in the hardware, and you can get started directly. In addition to these introductory exercises with minimal hardware, we will be running sessions with extended componentry, that we will build on during the training course.
- Upload to Arduino
- Pins, data, and the Inspector
- Fractional numbers and PWM
- Wiring configuration
- Adding nodes
- Node labels
- Constant nodes
- Input from a potentiometer
- Doing math
- Controlling servos
- Accessing help
- Mapping values
- Adjusting map range
- Logic nodes
- Reading lightness
- Comparing numbers
- If-else branching
- Smoother changes
- Pulse counting
- Using multiple timelines
- Showing text on LCD
- Displaying sensor values on LCD
- String concatenation
These tutorial exercises can be run outside of the Biomaker training sessions - to give a fuller range of experience with the programming interface and nodes. The required hardware can be found in the Starter Kit.
3. Building with software
We will provide a software library that provides XOD nodes for components present on the Keyestudio Multipurpose Shield V1 (right) and the LCD display and switches on the ProtoShield Plus (above). The use of these devices means that there is no need to struggle with error-prone wiring of circuits at this introductory stage. We will demonstrate:
(i) How to set up your laptop with the XOD software and connect the hardware. This will also be used as a platform for subsequent training sessions.
(ii) How to use simple devices like switches, variable resistors and LEDs to provide inputs and outputs for software programmes.
(iii) How to write information to the LCD screen for display, and how to toggle between display modes using the embedded array of switches.
(iv) How to read values from a sensor, and display these in real time.
(v) We will finish the session with a small scale programming challenge.