During my earlier experiments with GPIO on this board, I realised that it does not natively support PWM. I had a 4tronix Picon Zero board from my preparation for the Gnomes event and thought that could work with the DragonBoard.
As for the LED and IR detector I needed to use level shifters to connect up the board, so I added a second set to my breadboard and wired that up to the power and first I2C bus on the DragonBoard. This board has three I2C buses, two on the low speed connector and one on the high speed. It was a bit of a lashup as I had neither the right connectors for the DragonBoard(male 2x20x2mm) or the Picon (male 2x20x2.54mm).
I checked that it was working with the i2cdetect command. This needs elevated privileges to run.
To list the buses use:
sudo i2cdetect -l
To probe for devices on bus 0 use:
sudo i2cdetect -r 0
This will report a warning, but did not cause any issue for the 4tronix board.
WARNING! This program can confuse your I2C bus, cause data loss and worse! I will probe file /dev/i2c-0 using read byte commands. I will probe address range 0x03-0x77. Continue? [Y/n] Y 0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 20: -- -- 22 -- -- -- -- -- -- -- -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 70: -- -- -- -- -- -- -- --
It correctly detected the board at address 22 so I was happy that it was working. I tried to get the board to detect with Libsoc by combining a Libsoc test script with the getRevision function from the piconzero library that did not work reporting a timeout or no data returned so instead I followed the instructions on the 4tronix blog to install the library and examples.
wget http://4tronix.co.uk/piconz.sh -O piconz.sh bash piconz.sh
I also installed the python-smbus moduel which is a dependency for the piconz library.
sudo apt-get install python-smbus
Finally the library needed a minor change at the top as I was using bus 0 not bus 1. Edit piconzero.py and change the line that sets up the bus, as follows.
bus = smbus.SMBus(1)
I tested the version script and that produced a result.
linaro@linaro-alip:~/piconzero$ sudo python version.py Board Type: Picon Zero Firmware version: 7
I then added a servo and tested that.
linaro@linaro-alip:~/piconzero$ sudo python servoTest.py Tests the servos by using the arrow keys to control Press <space> key to centre Press Ctrl-C to end Up 85 Up 80 Up 75 Up 70 Up 65 Up 60 Up 55 Up 50 Up 45 Up 40 Up 35
Here's the results. Although the competition is over and my video presentation is submitted I'd still like to finish off the project with a 3D printed knight. If you are interested in my adaptions to the box, you can find those on the Workshopshed blog. Boxing the Dragon - Workshopshed