FEN LOGIC LTD. Gertboard User Manual Gert van Loo and Myra VanInwegen Revision 2.0 The Gertboard is an add-on GPIO expansion board for the Raspberry Pi computer. It comes with a large variety of components, including buttons, LEDs, A/D and D/A converters, a motor controller, and an Atmel AVR microcontroller. There are test programs for the Gertboard written in C and Python, which are freely available on the Web. This manual explains both how to set up the Gertboard for various control experiments and also explains at a high level how the test code works. Copyright 2012 by Fen Logic Ltd. All rights reserved. Contents Gertboard Overview ................................................................................................................................ 5 Labels and Diagrams ........................................................................................................................... 7 Power on the Gertboard ...................................................................................................................... 9 GPIO Pins ......................................................................................................................................... 10 Schematics ........................................................................................................................................ 11 Test Programs Overview ....................................................................................................................... 11 C Code Overview .............................................................................................................................. 11 Macros........................................................................................................................................... 12 Python Code Overview ..................................................................................................................... 13 Downloading the Software............................................................................................................ 13 Why Different Program Versions ............................................................................................... 14 Buffered I/O, LEDs, and Pushbuttons .................................................................................................. 14 Pushbuttons ....................................................................................................................................... 15 Locating the I/O Ports on the Gertboard ........................................................................................... 16 Testing the Pushbuttons .................................................................................................................... 17 Buttons Test in C .......................................................................................................................... 19 Buttons Test in Python .................................................................................................................. 19 Testing the LEDs .............................................................................................................................. 20 LEDs Test in C .............................................................................................................................. 21 LEDs Test in Python ..................................................................................................................... 22 Testing I/O ........................................................................................................................................ 23 Butled Test in C ............................................................................................................................ 24 Butled Test in Python .................................................................................................................... 24 Open Collector Driver ........................................................................................................................... 24 Testing the Open Collector Drivers .................................................................................................. 25 Open Collector Test in C .............................................................................................................. 26 Open Collector Test in Python ...................................................................................................... 26 Motor Controller ................................................................................................................................... 27 Testing the Motor Controller ............................................................................................................ 28 Motor Test in C ............................................................................................................................. 29 Motor Tests in Python ................................................................................................................... 30 Digital to Analogue and Analogue to Digital Converters ..................................................................... 32 Digital to Analogue Converter .......................................................................................................... 32 Analogue to Digital Converter .......................................................................................................... 33 Testing the D/A and A/D .................................................................................................................. 33 3