Meet the VoCore, a coin-sized Linux computer
Pins
As mentioned previously, the VoCore comes with 28 GPIO pins you can use for hardware projects. You can use these GPIOs out of the box, as it were, because they are accessible by writing and reading from virtual files at the Bash command line.
Although you have 28 pins (numbered 0 to 27), not all will be available all the time. The dock, for example, uses some of the pins to interface with the USB, microSD card reader, and Ethernet port. Other pins have special functions, and others are needed to perform tasks for the operating system. To see what pins you can actually use, type
# cat /sys/kernel/debug/gpio
at the command line, and you will see what GPIOs are doing and which are available. Running it on one of my VoCores gave me the list shown in Listing 2. Note that different firmwares will give you different results. In this example, I can use all the GPIOs that have (gpion)
in the second column.
Listing 2
GPIO Availability
# cat /sys/kernel/debug/gpio GPIOs 0-21, platform/10000600.gpio, 10000600.gpio: gpio-0 (gpio0 ) in hi gpio-7 (gpio7 ) in hi gpio-8 (gpio8 ) in lo gpio-9 (gpio9 ) in hi gpio-10 (vocore:green:status ) out lo gpio-11 (vocore:orange:eth ) out hi gpio-12 (gpio12 ) in hi gpio-13 (gpio13 ) in hi gpio-14 (gpio14 ) in hi gpio-17 (gpio17 ) in lo gpio-18 (gpio18 ) in lo gpio-19 (gpio19 ) in lo gpio-20 (gpio20 ) in lo gpio-21 (gpio21 ) in hi GPIOs 22-27, platform/10000660.gpio, 10000660.gpio: gpio-22 (gpio22 ) in lo gpio-23 (gpio23 ) in lo gpio-24 (gpio24 ) in lo gpio-25 (gpio25 ) in hi gpio-26 (gpio26 ) in lo
To set up and manipulate GPIOs, you write values into virtual files in the /sys/class/gpio/
directory. For example, suppose you want to switch on an LED connected to GPIO 22 (Figure 10). You can connect the LED's anode (+) to GPIO 22 and its cathode (-) to a GND pin.
On the command line, you first have to set the GPIO to accept OUTPUT (in Listing 2, this is set to in
). You do that by typing
# echo "out" > /sys/class/gpio/gpio22/direction
at the command line.
Now, you can send a 1
to the pin to set it HIGH:
# echo "1" > /sys/class/gpio/gpio22/value
The LED will switch on. From here, it's trivial to write a Bash script version of Arduino's Blink sketch [7]. Of course, you can also do that from Python, C, Perl, and so on, using the file read and write functionalities of each language.
Reading from a pin (e.g., to know the state of a button) would work the same way, but you would set the GPIO you want to read from to in
:
# echo "in" > /sys/class/gpio/gpio22/direction
and then read it from the /sys/class/gpio/gpio22/value
file.
Conclusion
The VoCore is a very interesting piece of kit with lots of potential. Its tiny size makes it great for wearables – or for any project that requires "brains" with a small footprint, for that matter. Although it is short on memory and storage space, being equipped with WiFi makes it ideal for receiving and transmitting data to other devices in its environment.
Be warned, however, that the VoCore is work in progress, and some things are still in the pipeline. For example, reading and writing to the microSD card reader on the dock is ridiculously difficult at the moment and well beyond the scope of this article, but development for the device is ongoing, and working with the gadget is great fun.
Infos
- VoCore homepage: http://vocore.io/
- OpenWrt project: https://openwrt.org/
- PuTTY: http://www.chiark.greenend.org.uk/~sgtatham/putty/
- OPKG – OpenWrt's package manager: http://wiki.openwrt.org/doc/techref/opkg
- VoCore firmware: http://vonger.cn/upload/vocore16.bin
- VoCore's upload page: http://vonger.cn/upload/
- Arduino Blink sketch: https://www.arduino.cc/en/Tutorial/Blink
« Previous 1 2 3 Next »
Buy this article as PDF
Pages: 8
(incl. VAT)