- 1. Config Raspberry Pi serial port
- ardSerial.py">2. Change the permission of ardSerial.py
- 3. Use ardSerial.py as the commander of Nybble
As shown in the serial protocol, the arguments of tokens supported by Arduino IDE’s serial monitor are all encoded as Ascii char strings for human readability. While a master computer (e.g. RasPi) supports extra commands, mostly encoded as binary strings for efficient encoding.
1. Config Raspberry Pi serial port
In Pi’s terminal, type sudo raspi-config
.
Under Interface option, find Serial. Disabled the serial login shell and enable the serial interface.
A good tutorial on Instructable
If you plug Pi into NyBoard’s 2x5 socket, their serial ports should be automatically connected at 3.3V. Otherwise pay attention to the Rx and Tx pins on your own AI chip, and its voltage rating. The Rx on your chip should connect to the Tx of NyBoard, and Tx should connect to Rx.
2. Change the permission of ardSerial.py
If you want to run it as bash command, you need to make it executable:chmod +x ardSerial.py
You may need to change to the proper path of your Python binary on the first line:#!/usr/bin/python
3. Use ardSerial.py as the commander of Nybble
You need to unplug the FTDI converter if you want to control Nybble with Pi’s serial port.
Typing ./ardSerial.py <args>
is almost equivalent to typing <args>
in Arduino’s serial monitor.
For example, ./ardSerial.py kcr
means “call skill crawl”.
Both ardSerial.py and the parsing section in Nybble.ino need more implementations to support all the serial commands in the protocol.
Note: Reduced motion capability when connected to Pi!
I have to mention that with the additional current draw by Pi, Nybble will be less capable for intense movements, such as trot (the token is ktr). The system is currently powered by 2S-14500. You may come up with better powering solutions, such as using high drain 7.4 Lipo batteries, or 2S-18650. There’re a bunch of considerations to collaborate software and hardware for a balanced performance. With Nybble’s tiny body, it’s better to serve as a platform for initiate the communication framework and behavior tree rather than a racing beast.