Categories
Hardware hardware_ robots

Robot prep: PWM control

I started up a raspberry pi with raspbian installed on it. (I used balena’s etcher to flash an sd card): the light version, basically just Debian OS for rpi: https://www.raspberrypi.org/downloads/raspbian/

https://www.balena.io/etcher/

The RPi needs a proper keyboard, at least until you set up ssh and can access it remotely. (

We’re interested in making a robot, and we’re using a Raspberry pi. So we need to control servos. RPi only has a single PWM pin, so we need to use an I2C module https://learn.adafruit.com/16-channel-pwm-servo-driver to control however many servos our robot needs, and the software libs to run it https://github.com/adafruit/Adafruit_Python_PCA9685

adafruit_products_ID815servo_LRG.jpg

and we need an external 5V PSU, to power the servos.

Configuring Your Pi for I2C:

sudo apt-get install python-smbus
sudo apt-get install i2c-tools

Need to connect the RPi to the servo driver. This was a picture taken when testing it on the RPi Zero W in 2019. The instructions for pinout connections: https://learn.adafruit.com/16-channel-pwm-servo-driver/pinouts

Or from Adafruit, for RPi:

adafruit_products_raspi_pca9685_i2c_bb.jpg

(or Arduino)

adafruit_products_AllServos_bb-1024.jpg

Here’s an rpi zero layout.

Ok but how do we power servos? We can’t run it off the RPi’s 5V 2A. Oh duh, there’s that big DC socket connected to the PCA9685

There is something to be said for running the robot on an Arduino. You get something robotic. You upload someone’s hexapod spider code, and it does a little dance. You can control it remotely. It can interact with sensors.

Arduinos are dirt cheap. So I bet we could have tiny neural networks running in arduinos… shit, do we already have them? Let’s see… ok wow there is like a whole thing. https://blog.arduino.cc/2019/10/15/get-started-with-machine-learning-on-arduino/ ok but 2K of RAM is not much. You would need to be a real demo scene junky to use a 2KB NN, but yeah, you could do something crudely intelligent with it.

Robots on ESP32s are definitely a thing. But ok no, Raspberry Pi for real robot. We need Linux for this.

Ok so I need to wire this up. But I also need a chassis for the robot.