Originally published on my blog at halldorstefans.com on October 19, 2020
This post is kind of a sequel to my previous post, First Steps Creating a Robot with MicroPython and Pyboard.
First Steps Creating a Robot with MicroPython and Pyboard
Halldor Stefansson ・ Jul 20 '20 ・ 3 min read
I know you'll see straight away that there's a contradiction between using Arduino vs Pyboard, but I'll get to that later, I promise.
Running the motor(s)
Continuing from where we left off in the last article, I was wondering how I could control two DC motors.
After a bit of research, I found out that I could use an H-bridge chip to do that. How to Build an H-bridge Circuit to Control 2 Motors.
Lucky me, I owned an Arduino starter kit, which included an H-bridge motor driver L293D.
Using the above article, about building an H-bridge circuit, and the project book included in the Arduino kit, I started connecting everything up and looking forward to seeing the motors run.
I started by connecting just one motor to make sure I got that right. Since the project book had one project doing precisely that, it was relatively straightforward, and the motor ran. Yay!
Since that was pretty painless, then surely all I had to do was to connect the second motor, and that would be that, right?
But, of course, it wasn't. Unfortunately, I couldn't get both motors running with the H-bridge I owned. Maybe it was broken, or I did something wrong, either way, I wasn't sure what to do.
Maker Drive saves the day
So I started to search for a new one and see what it would cost. I also searched for some alternatives.
That's when I found Maker Drive, a simplified H-bridge motor driver.
Even though it's a simplified H-bridge and I'm confident I could figure out how to use a standard H-bridge to run the motors, it would be easier to get the motors running and then later I could upgrade to a standard H-bridge.
Once the new motor driver arrived, it didn't take me long to get both motors running - credit to good documentation.
Back at it 😊
Motors working with the new motor driver ✅10:58 AM - 20 Sep 2020
Connecting to an Arduino
Ok, now the motors were running, but I needed something to control them. That's where I decided to go for Arduino over the Pyboard. For the same reason I chose Maker Drive over a standard H-bridge, I wanted the car up and running as soon as possible and then I could switch change the controller later.
And after watching this video, Getting Started with Maker Drive and Arduino, it was pretty straightforward. I just followed the video and a few moments later, my car was running in circles just like the code implied. :D
What next?
Woohoo, it works! Now what?
Well, I've two possible next steps, and I'm not sure which way to go. Either I could make it more fun by adding some sensors to it, so it could drive around without crashing or drive around a track, or I could switch out the Arduino for the Pyboard.
Since that was my initial idea, I'm leaning towards that. I could then later add the sensors, but I'm not sure.
What do you think?
Thank you for reading. For weekly updates from me, you can sign up to my newsletter.
Top comments (0)