4tronic's Initio Robot Kit is a nice way to get started with robotics, sensors and working with Python on an embedded device.
We are uisng PiRoCon and NOT RoboHAT as Shield on Raspberry Pi to Connect to the Rover
Various Tutorials from 4Tronix
- Basic Information on PiRoCon Robotics Controller: https://4tronix.co.uk/blog/?p=163
- Assembling Ultimate Initio Kit for Raspberry Pi with Pirocon: https://4tronix.co.uk/blog/?p=820
Create SD Card
- Download Raspbian to create an SD Card for Raspberry Pi (Take the "lite" Version without Desktop
- Unzip File to get the .IMG for putting on the SD Card (4 GB SD Card is good, not more memory required)
- Create an SD Card with the Image File.
- Connect Keyboards & HDMI Screen and login to the Raspberry PI (User: pi, Password: raspberry - Attention: English Keyboard Layout! 'z' vs. 'y'!)
Connect to Network & SSH
- Enable SSH, SPI and I2C
- Go to
5. Interfacing Optionsand enable these three one by one. (P2, P4, P5)
- Optional - setup WIFI (if you raspberry PI support Wifi or if there is a Wifi Dongle Connected)
- Set IPs to IPv4a as they more easy to read.
sudo nano /etc/sysctl.conf
- Setup Wifi
wpa_passphrase "<ssid>" "<password>" >> /etc/wpa_supplicant/wpa_supplicant.conf(Attention: special Characters need to be escaped!)
- Check if data is correctly stored
sudo less /etc/wpa_supplicant/wpa_supplicant.conf
- Connect to Wifi
wpa_supplicant -c /etc/wpa_supplicant/wpa_supplicant.conf -i wlan0(Info: '-i' is the device to connect the network)
ifconfigto see, if everything is fine and get the IP address of the adapter
- Try a
ping 188.8.131.52to see if there is connectivity to the outside internet.
- Try ssh into Raspberry
ssh pi@<your-ip-address>(Password is still "raspberry"; Host and Client must be in the same Network/Subnet and not firewall must block connection)
- You should run
apt-get dist-upgradeto get patched and updated for libs.
- Make your IP Static: https://raspberrypi.stackexchange.com/questions/37920/how-do-i-set-up-networking-wifi-static-ip-address
- Set your Team name in
/etc/hostnameso you can connect more easily to your RoboCar.
Setup PiRoCon (Robo Shield for Raspberry Pi)
- First we are going to install some tooling we need to control the pHat (see in detail https://4tronix.co.uk/blog/?cat=4)
curl -sS https://get.pimoroni.com/unicornhat | bash
- We also need a Pythn Library to connect to SPI:
pip install spidev
- Get a Script to fetch some tests for Initio `wget http://4tronix.co.uk/initio.sh -O initio.sh``
- And run the Script
bash initio.sh(see https://4tronix.co.uk/blog/?p=505)
- The folder
./initioyou find various scripts to test the features of the rover.
Controlling the Servos for the Ultra Sonic Head
Communication with the Servos is not done via GPIOs (although it would be possibile), see https://github.com/4tronix/PiRoCon/blob/master/python/servo.py
Instead communication is done via a the [ServoBlaster Daemon] (https://github.com/richardghirst/PiBits/tree/master/ServoBlaster). If you use intio.py to communicate with the Servos, this Library is starting the Daemon via
os.system and shutting it down at the end.
For manual Testing you can do this on your own as well:
- Start Daemon:
./servod --pcm --idle-timeout=20000 --p1pins="18,22"
- Sen Commands
echo P1-18=120 > /dev/servoblaster
- Don't forget to kill your process again.
If you have trouble this the binary of ServoBlaster provided, you might want to Build this one yourself.
mkdir -p ~/servoblaster/ cd ~/servoblaster/ git clone https://github.com/richardghirst/PiBits mv PiBits/ServoBlaster/ . && rm -rf PiBits cd ServoBlaster/user sudo make install
The new version will be stored in
/usr/local/sbin (!) so you have to adapted
initio.py to not use the local, but this globale binary of servod.
This are the Specifications of the Tower Pro SG90 Servos.
- 1 - 2 ms Duty Cycle
- 20 ms (50 Hz) PWM Periode