My Raspberry Pi dual motor driver has evolved quite a bit since I last wrote about it. In the original incarnation, I had planned on using the PWM capability straight from the Raspberry Pi to drive the TB6621FNG motor driver. That didn’t work so well due to the fact that Linux on the Pi isn’t a real-time OS, and there is only one hardware PWM.
To get around that, I added a PIC16F1826 to directly drive the motor. The Pi will send commands over I2C to the PIC, which will control the motor driver. It’s almost identical to an older (pre-Raspberry Pi) design I have.
Once I figured out how to reliably use I2C on the Pi, it turned out to be a good route to take. The PIC is inexpensive and plenty capable of doing the job. The Pi doesn’t need to worry about real-time control.
Below, I’ve got the almost complete robot stack: Motor mounting board, USB hub with WiFi adapter, Pi Zero, LiPoly supply, and I2C motor driver board. It’s also got a Sparkfun IMU board that will soon be replaced by my own.
This is only sort of a new design. I’ve used this TB6621FNG dual motor driver chip on a number of my boards prior to this one. I basically just took one of my existing boards and shuffled things around a bit to fit the Raspberry Pi Zero form factor.
In this photo, I’m using it with a Pi A+ while writing some Python code to test it out. Eventually (when I can get more than one Pi Zero), I plan to use this in a stack, with a Pi Zero, my LiPoly battery board, and my USB hub board for WiFi.
When we last heard from out intrepid Simblee Breakout Shield, it was found to be using and open drain linelevel converter without pull-up resistors, and that’s against the law. Or, at lease against good judgement.
After a dual face palm, I found the TXB0108PWR chip, again from Texas Instruments. This one is a push-pull line level converter, so no pull up resistors are needed on the GPIO. The pin-outs are close between the two chips, but not exact. Too bad. It would have been nice to just drop in the different chip. But, the I2C still needs pull ups anyway. ,I gave it a TXS0102 open-drain converter, and pull-ups and ordered the revised boards.
After I build and test this one, I’ll move on to the next version. I want to dispense with the breakout, and put the Simblee chip directly on the shield. I’m also going to use Silego chips for the line level converters. If you haven’t heard of the Silego chips, they’re very small mixed-signal programmable logic. I’ll write more about them later.
Run Fourier, run
I stumbled, and made progress on my Simblee breakout shield. If you didn’t see the first installment, check it out first.
Since the first post, I built up a non-shorted board. It seemed mostly okay, except that it gave me 3.9 volts on the 3 volt side, and the same on the 5 volt side. The answer to the puzzle lead me to one of the downfalls of open source hardware (well, it’s only a downfall in combination with poor practices). That is, not knowing what the original designer had in mind.
I took a look at the Arduino 101, which uses a 3 volt Intel Curie module. The Arduino 101 uses a Texas Instruments LSF0108PWR line level converter chip. Works for them, so I designed it in. Folly me, I didn’t read the data sheet close enough. It’s an open drain device and needs pull-up resistors on the I/O lines.
The 101 didn’t use pull-up resistors. It gets by because most 5 volt devices are fine with the 3 volt “1”. They’re really just using the chip as a5 volt to 3 volt done converter and not worrying about going up to 5 volt line levels.
Why not push ups?
I solved the final issue with my LiPoly board. It was a minor one. The yellow LED is supposed to indicate whether the LiPoly battery is on or off. It was always on. In a Captain Obvious moment, I discovered that it was always on, because I told it to. I had connected both sides of the DPDT switch together. Why? I don’t know.
But, with a lifted pin, one cut trace, and a short mod wire, it’s all set.
I already have the next set of PC boards on the way, so they’ll still require this mod. It’ll be easier to deal with before there are parts on the board. I may not order any more boards, with this fixed. I’ll have plenty for my own uses, so unless I decide to sell it, there won’t be a need. I’m thinking about a Kickstarter for this though…
Poly want a… Poly want a… Poly want a Lithium?
I’ve been having a lot of fun with my Raspberry Pi boards lately, as I’ve described in a few of my prior posts. With that under my belt, I decided to get out my BeagleBone Black and put it to use.
Unfortunately, I did something terrible to it – or just made a simple undiscovered error. When I plugged it in, my PC recognized it as as drive, as it’s supposed to. However, after downloading and installing the latest version of the drivers, that situation changed. I can no longer see it as a drive, I can’t see it on wired Ethernet, and I can’t see it on WiFi. I get te same results when trying to boot natively, and with a micro SD the most recent Ubuntu distribution. Yyargh
Update – I got it working. I just flashed Ubuntu onto the BBB instead of boothing from the SD or the old eMMC image. I’m thinking about putting ROS on it now and see what I can do with it.
Not stack-up, as in PC board layer stack-up, but add-on board stack-up…
The LiPoly board is working fine, as detailed in my prior posts. The USB hub board is also working. The stack shown here has the Pi Zero and both boards. As shown the D+ and D- lines from the USB hub aren’t connected to the Pi.
For the moment, I connect them with a cable, but I’ve got a small interconnect PC board on the way. With that, I won’t need extra cables and won’t need to hard solder the boards together. I’ll post pictures when it comes in.
She’ll be coming ’round the mountain when my boards come in
I built up two more of my Raspberry Pi LiPoly battery back up boards today. After doing so, it occurred to me that, in addition to allowing for portable use of a Raspberry Pi Zero, as I had originally intended, the board, with a few minor modifications, will work quite well as a UPS (uninterruptible power supply).
I wired the output from the comparitor to GPIO 21 on the Pi expansion header. I’ll be able to monitor it to detect when the external power is off. I can then gracefully shut everything down.
Without anything else running, a small 150 mAh battery will give me about 40 minutes run time with a Pi A+, and about 20 minutes with a Pi 3. Add in peripherals, and it will go down a bit from there. Regardless, it will have plenty of time for a clean shut down, or to wait out a short power outage.
The cover image here shows my Pi A+, and my Pi 3 with their UPS integrated. I still need to drill a hole in the case lids so I can flip the power switch. Otherwise, I’ll have to pop the lid off if I want to completely shut it down. Not a big deal, but still something I should do.
My Pi Zero LiPoly board was working, but not exactly in the way it’s supposed to. Charging was fine. Powering the Pi from the battery, fine. Th problem came on the net MCP_IN, in the schematic below. I was reading voltage at the test point for MCP_IN, JP4.
Either the comparitor wasn’t comparing properly, or the MOSFET wasn’t blocking all current when shut off. Or, something else was wrong.
That “something else” was a pretty rookie mistake. See if you can find it before looking below…
Long enough. My comparitor was wonky, because it was unpowered, as you can see in the image below. +5 volts doesn’t actually connect to the +V pin on the comparitor chip.
Fixed that and it works exactly as expected now.
I’m far from the first person to put together a Pi Zero USB hub. In fact, mine is loosely based on the open source design from @richardhawtorn, which was based on the design by @MakerBro.
The key difference is that I removed one of the USB A ports in exchange for a reduced footprint. As much as possible, I’d like my Pi Zero boards to have the same footprint. This design allows for a small USB WiFi adapter to be plugged in while remaining within the Pi Zero board outline.