Here's a setup that requires more breadboard work but is simpler and well-documented:
Ah you're right, forgot about that.
Here's a beefy bastard that looks pretty simple compared to what you're working with now:
http://www.robotshop.com/en/10a-5-30v-dual-channel-dc-motor-driver.html
It's overkill but it would allow you to upsize the robot in the future.
Got the new controller wired up.
Now I need to get back to programming.
Where is the entire wire numbering chart? Which are pwm out?
This one looks simple. I hope to have the stupid thing moving this week. My kids are done with school now. The schedule could not be better.
Got it!
The new motor controller works, and I can make stuff happen. Now for the easy part?
I want to have it do a subroutine when I press a button. So, a "turn left", "Turn right" "go forward" and "go backwards" subroutine and four buttons.
Something like that. I can figure out the tiny subroutines, but I don't know how to put them into a "wait for the button" command, nor how to make them only wait for more buttons once the subroutine is finished.
This is important because it's really hard to hit the 'run' button, unplug the mouse, unplug the keyboard, unplug the monitor, and then let it go.
Thanks for the help so far! I hope to have some fun with the kids tonight showing them how it moves.
Rather than building buttons you can do it with different Python scripts executed remotely over an SSH (or VNC, if you'd like) connection. That means you'd also have remote control.
GameboyRMH wrote: Rather than building buttons you can do it with different Python scripts executed remotely over an SSH (or VNC, if you'd like) connection. That means you'd also have remote control.
I don't know what either of those acronyms means, but if it means spending money, I'm out.
Buttons!
Hahaha no there's no spending required, all free software, it's cheaper than buttons in fact.
SSH is a remote terminal, VNC is a remote desktop.
GameboyRMH wrote: Hahaha no there's no spending required, all free software, it's cheaper than buttons in fact. SSH is a remote terminal, VNC is a remote desktop.
ok, show me how to set it up.
So we're talking about hitting buttons on a laptop and making it go from its wifi?
Yep that's basically the idea. More specifically I'm thinking about setting up one python script that waits for arrow key inputs that move the robot. Here's how to set up an SSH connection:
https://www.raspberrypi.org/documentation/remote-access/ssh/
GameboyRMH wrote: Yep that's basically the idea. More specifically I'm thinking about setting up one python script that waits for arrow key inputs that move the robot. Here's how to set up an SSH connection: https://www.raspberrypi.org/documentation/remote-access/ssh/
How do you code it to look for arrow keys?
There are many ways, but I found some simple example code here:
https://stackoverflow.com/questions/510357/python-read-a-single-character-from-the-user
If you post the test code you're working with (use PasteBin) I could help you put something together.
GameboyRMH wrote: There are many ways, but I found some simple example code here: https://stackoverflow.com/questions/510357/python-read-a-single-character-from-the-user If you post the test code you're working with (use PasteBin) I could help you put something together.
I am having trouble with that, the Pi crashes if I try and open up this website on it. I am not sure why. I'll see if I can get it off with a thumb drive.
I tried to add some logic in there to allow me to control the direction, but it's incomplete. I am not a programmer:
1: How do I do that? I have two wires, when ground they go one way, when high they go the other way. Not sure how to set that up.
2: How do I place pieces of this inside code which allows me to activate parts of the code under certain conditions and whatnot?
Thanks
From what I can see in the controller's manual, the controller's direction inputs consider >3V to be high and <3V to be low, so you should be able to connect these to digital outputs on the raspi and switch them easily. It has another mode you can use to save on outputs on the RasPi, where the PWM pins are tied high and the PWM signals are sent to the DIR pins, where 50% is stopped and less than that is reverse and more is forward. You can use whichever mode you like.
Many ways to do that, that's what we'll get to now. In general I'd say you'll want to write functions you can call which will easily set direction and speed on the motors with something like setmotor('left','forward',50) . The dirty work code of setting digital output conditions and PWM duty cycles and frequencies would go inside those functions.
So, to be clear, with the test code you have now, you've got the left motor turning for 10 seconds, then the right motor turning for 10 seconds, then both motors turning for ten seconds? That all works?
GameboyRMH wrote: 1. From what I can see in the controller's manual, the controller's direction inputs consider >3V to be high and <3V to be low, so you should be able to connect these to digital outputs on the raspi and switch them easily. It has another mode you can use to save on outputs on the RasPi, where the PWM pins are tied high and the PWM signals are sent to the DIR pins, where 50% is stopped and less than that is reverse and more is forward. You can use whichever mode you like. 2. Many ways to do that, that's what we'll get to now. In general I'd say you'll want to write functions you can call which will easily set direction and speed on the motors with something like setmotor('left','forward',50) . The dirty work code of setting digital output conditions and PWM duty cycles and frequencies would go inside those functions. So, to be clear, with the test code you have now, you've got the left motor turning for 10 seconds, then the right motor turning for 10 seconds, then both motors turning for ten seconds? That all works?
Yup! It works great!
The kids are excited. I still have not figured out how to add a fully functioning digital output for direction, or digital input, for a button, but we're getting there.
Oh, and I had not realized that there was a 0-50, 50-100 mode, but for clarity in code, for the kids use (because I hope they will play with the code) I'd say let's just run the direction as a digital output.
I threw this together quickly, I blind-coded it so you'll be the first one testing it, but it should let you use the robot as an RC car:
So you haven't posted any updates...is it because it's not working or because you're having too much fun with the robot?
Haven't tried it yet, I'm a terrible person.
We're going to be on vacation for a while, and we're planning and packing and such. I want to try and play with it tonight or tomorrow night with the kids.
Tuesdays are tough because they have Trail Life outings
Wednesdays are tough because we get back from church late
I finally got to try it.
It didn't work!
It opened up a window, and told me to hit buttons to control it, but when I typed those buttons it just put them in the box.
So it looked like this:
Press A/W/S/D:
aaassswwdddd
But nothing moved.
Your way over my head in terms of programming, so I can't diagnose this without added knowledge.
You'll need to log in to post.