This article is part of a series.
- Part 1 - Installing Arch Linux on Raspberry Pi with Immediate WiFi Access
- Part 2 - Setup i2c on Raspberry Pi Zero W using Arch Linux
- Part 3 - Setup NodeJS Project Space on Raspberry Pi Zero W
- Part 4 - Porting DRV8830 I2C Motor Driver Code to NodeJS
- Part 5 - Editing Raspberry Pi Code Remotely from Visual Studio Code
- Part 6 - This Article
- Part 7 - Google Vision API using Raspberry Pi and Node
Not too long ago there was a post on Hackaday about a little four-wheeled bot made with a Raspberry Pi and some eBay motor drivers.
I really liked the little chassis, ordered one, and was happy to find it was delivered with the motors already mounted. (As I become an aged hacker, it’s the little time savers which are genuinely appreciated.)
On buying the chassis I’d already decided to use one of my Raspberry Pi Zero W’s (rp0w) to control the bot. I really like Arch Linux on the rp0w. It’s light weight and the packages are well curated. Again, it’s the little time savers. I liked the combination even more since I found a way to set the rp0w headlessly, which meant I could go from SD card to SSH’ing into little Linux board.
Coincidentally, I purchased several DRV8830 modules from eBay. This is a sad story – I’ve played with the DRV8830 chip a long time ago:
Because Sparkfun did a great job of documenting the IC and creating an Arduino library to go with it. I was disheartened to find Sparkfun and EOL’ed the boards.
Probably because buttholes like me kept buying them off eBay. I’ve got some mixed feelings here – one of them is guilt.
Anyway, I was surprised to find the mounting holes on the DRV8830s matched a set on the chassis. I decided to attempt using one module to drive two motors, thereby only needing two DRV8830 modules to drive the entire bot.
I’ve had some thermal paste lying about for years–it works nicely as an adhesive. Also, I was hoping to use the chassis to heatsink the motor drivers.
Ok, for these reasons I decided to build this bot using NodeJS. I’ve written a separate article on setting up NodeJS, working with i2c-bus, and porting the DRV8830 Sparkfun library to NodeJS.
- Not yet written (shesh, been busy. Judge much? :P)
It didn’t take time at all to get the little motor spinning using NodeJS largely due to Michael Hord’s (Sparkfun) MiniMoto library. (Again, some guilt here.)
I drove the motor shown using two series Li-Ion batteries connecting to a buck converter set to output ~5.0v. The motor spun nicely and pulled around 200mA. However, the real test would be connecting to two geared motors per DRV8830.
It was time to wire up the chassis motors and create a test of the system. The wire used was some eBay single core aluminum wire (the cheap stuff). Wiring was pretty straightforward.
However, I did make a little i2c bus board from perfboard and JST connectors. Adding both ceramic and electrolytic decoupling capacitors for smoothing and to aid peak discharge.
Note the heaping amount of heatsink goop on the underside of the perfboard, this was a hacker’s solution to galvanically isolating the perfboard from the steel chassis.
+--------------+ +------------------+ +------------------+ | | | | | | | +--+LEAD1+----+OUT1+-+ |VCC----+5V-+ | | | | | | | | Motor 1 +--+LEAD2+----+OUT2+-+ DRV8830+A +----GND----+ Buck Regulator | | | | | | | | | | | | | | | | | | | +--------------+ +-----+---+--------+ +--+--+------------+ | | | | SDA1| | SCL1 5V | | GND | | | | | | | | | | | | | | | | +----+---+--------+ | | | | | | | | | | +----+VCC2+--+ ADUM1250ARZ ++VCC1+--------+ | | | | | | ++GND2+--+ ++GND1+-----------+ | | | | | | +----+--+---------+ | | | | | | SDA1| | SCL2 | | | | | | | | | | | | +-----+---+-------------+--+-------+ Raspberry Pi Zero W
The ADUM1250ARZ is a bi-directional galvanic isolator for digital communication up to 1mbs. It’s the first chip I ever designed a PCB for and it’s still my favorite. Essentially, the ADUM1250 seperates the rp0w from the noisy motors – and more importantly, if I screw something up on the motor side, won’t kill my rp0w. The ADUM1250 is not necessary for most people, just me
The last bit I had to figure out was the the Raspberry Pi’s power. I attempted to use a single Li-Ion battery and a boost regulator to power it, but the regulator’s I bought were DOA.
Then I remembered the load-sharing and boost converter circuit salvaged from a battery bank. The charge circuit was built for Li-Po chemistry and the only Li-Po I had lying about was a 350mA. I wired it up and was surprised the whole thing worked, with the added benefit of being able to charge the rp0w battery without disconnecting it. Booyah!
The last bit I did for the video. I pulled the
npm package keypress and wrote this little program.
Then, I shot the following video and called it donesies.