Objectives: (i) install the software and USB drivers to allow XOD graphical programming of the Biomaker starter kit, (ii) test the connections and software installation by assembling simple patches for the Rich UNO R3 Arduino board, (iii) enter parameter values for XOD nodes and download the code to the board to flash an onboard LED. (iv) Plug a bright external LED from the starter kit to the same port and test. Revise the graphical program to include input from an onboard touch switch. (v) Use the XOD watch node for real-time debugging. (vi) Learn about conditioning signals by connecting the XOD not and flip-n-times nodes. (vii) Divert the output from the LEDs to the onboard piezoelectric buzzer. You should gain a basic understanding of XOD based programming of Arduino microcontrollers after this tutorial.
Requirements: (i) Computer running MacOS, Windows or Linux (.rpm or.deb), (ii) Biomaker starter kit (2018-2019 version). More information about the Biomaker starter kit can be found at: https://www.biomaker.org/2019-starter-kit
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. A software driver may be required to allow communication between your computer and the board (if not already installed).
(1) Type B USB connector, consistent with Arduino UNO R3, for ruggedness and long service life. USB interface driver chip: CH340G, compatible with win7, win8, linux, MAC OS. Uses Arduino UNO bootloader.
(2) Onboard 500mA resettable fuse to protect power supply from the USB port and the DC jack at the same time.
(3) 4 digit display: 4 digit tube (0.36 inches) which can display the clock point, it needs D10/D11 pins to control and display the integer, clock, stopwatch, score, etc.
(4) Piezoelectric buzzer
(5) DS1307 clock: based on DS1307 high-precision real-time clock module, I2C interface, the address is 0x68.
(6) LM75 temperature sensor: I2C interface temperature sensor, can be used to measure the temperature, and set a temperature protection temperature, the address is 0x48.
(7) Infrared receiver: use D2 pin, It can receive the modulated infrared signal of 38KHz that is sent by the IR transmitter module and demodulate it into logic level, and it can complete the infrared remote control with the codec program.
(8) Reset switch
(9) 4-CH touch sensor: capacitive touch switches, activated when you touch the corresponding position with your fingers, uses digital ports (D3 / D4 / D5 / D6).
(10) Onboard DIP switches, allows disconnection of onboard peripheral modules.
(11) Microcontroller: Atmel ATmega328P, working voltage: 5V, working current: 500mA (Max), IO logic voltage: 5V, 100% compatible with Arduino UNO R3 program, expansion shields, IDE.
(12) Rotation angle sensor: 10K ohm adjustable potentiometer knob angle sensor, use A0 pin, can be used for MP3 volume adjustment, 4-digit display brightness adjustment.
(13) Onboard Arduino Shield interface, can plug in compatible expansion shields.
(14) Serial MP3: MP3 music player module is based on high-quality MP3 music chip, use D7 / D8 pins to be software serial port, you can send commands to switch songs, change the volume and play mode and other operations.
A USB driver is a file or a group of packets that allow the computer to interact with the USB ports. Since you are connecting the Board with your computer to upload code on it, you will need the proper USB drivers to allow that transfer.
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 can be found at: https://www.arduino.cc/en/Guide/HomePage - to help with the installation.
If you are a linux user, your library should have packages that will allow you to do the same. Type "usb driver" in the research bar of your packets manager, and select the ones that have CH34x for I2C and SPI/GPIO drivers.
The XOD development environment is an open source software that can be used to program microcontroller boards. Just like the arduino IDE, it uses an adapted version of C++ but the XOD environment does not require text-based coding and has a graphical interface instead. We recommend that you download the desktop application of the XOD development environment that is suitable for your computer from https://xod.io/downloads/. Note that there is also a web-browser based version also available.
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.
As an alternative way to understand how XOD works and how to use it, go to https://xod.io/docs/tutorial/ where you will find very good, web-based tutorial materials. Completing the entire tutorial takes about one hour.
Navigate to the bottom of this page to download the XOD code for this tutorial. A file named tuto1_kaiRyn0QME.xodball should be downloaded to your computer. Open this file in XOD. You should see a new item appear, which should contain a list of tutorial patches.
Plug in the Rich UNO R3 board to your computer with the provided USB-A to USB-B cable. (You may require an adapter if your computer lacks a USB-A connector).
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 lighting of this LED - as a simple test to check setup of the board and software. You will also find the square-wave and flip-n-times nodes in the xod/core library. (Navigate to https://xod.io/libs/xod/core/ - to find a documented list of functions found in the default xod/core library. Further documentation can be found at: https://xod.io/docs/). Either the square-wave and flip-n-times node can be dragged into a patch, and connected to the luminance port of the LED node. These nodes allow you to flash the LED for a set number of times or continuously, and to program the frequency, duty cycle, number of flashes.
More spectacular LED output can be arranged by plugging in the LED module that can be found in the Biomaker Starter Kit.
The LED module can be connected to GND, VCC (5V) and SCK (D13) port found as pins on the Rich UNO board, using female-female leads provided in the Biomaker Starter Kit. Be sure to connect GND-GND, VCC-VCC and SCK-SIG (D13). The brighter LED will echo the behaviour of the smaller LED found on the Rich UNO R3 board - both are connected to the same port.
Touch buttons are connected to ports D3-D6 of the Rich UNO R3 board. They are set to the logic level HIGH and come down to the logic level LOW when pressed. The state of the switches can be read using the button node from the default xod/common-hardware library. The button node provides debouncing for a key switch, and the signal can be further conditioned by connecting the output to a not node from the xod/core library. The signal can be directly fed to the luminance value (Lum) of an LED node connected to port D13.
Key switch signals can also be fed into a flip-n-times node, available in the default xod/core library. The flip-n-times node can be set to turn on and off a set number of times for different lenths of time. The output can be used to control the brightness of the LEDs. An additional button can be used to provide a reset signal to the UPD input of a button node, if required.
Marco Aita has encapsulated the Arduino tone library in a XOD library - and this contains a node that can be used to drive and control the pitch of the buzzer. To import that library, click on the 'import library' button on the top left hand corner of the screen. Click the highlight icon (shown below) and import marcoaita/malibrary. This should insert
A piezo-electric buzzer is provided on the Rich UNO R3 board, positioned adjacent to the 4-digit display. It 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.
Identify the buzzer node in the tutorial code, copy into a patch and experiment with the use of inputs from other devices on the shield, such as using the onboard touch switches as a simple keyboard or changing the pitch with the variable resistor (potentiometer A0). The buzzer provides a useful device for audible alarms.
You can now control two of the kit's hardware parts; Congratulations!
Endless possibilities are now open to you to build simple patches and interact with the board. To get a good handle on how xod interacts with the board, you can try the following simple exercises :
- Change the touch button you use to interact with the LED/buzzer. Touch buttons 1-4 are connected to pins D3-D6 of the board.
- Change the pitch of the buzzer by tweaking the frequency
- Make the buzzer and the LED connect to the same button and make the buzzer turn on and LED turn off when the button is pressed
- Create a four musical notes piano by linking the buzzer at different frequencies to each of the four buttons
- Add a repeating blinking LED as a metronome. (look up XOD tutorial on how to make loops for help https://xod.io/docs/tutorial/205-loops/ )