Aquse
Posts: 2
Joined: Sun Apr 20, 2014 3:09 pm

Can this supposedly work?

Sun Apr 20, 2014 3:18 pm

Hey, I've got an idea for a project. It's basically a rip off from the letsbuildrobots starting robot. It will have an Ultrasonic Distance Measurer on top of a Servo and 2 Motors controlled by an L298N. The robot will move. Check distance every 2 seconds in 3 directions and move again to the path which is longest. Programming shouldn't be a problem, I'm pretty experienced at that. But this, I will be doing for the first time.(Outside of soldering a berryclip)

I drew a crappy diagram to show everything. 1 Motor excluded, I just couldn't fit it. http://puu.sh/8f7pI/7a099a3f33.png(Sry for the shitty diagram, couldn't find a free and easy to use one online.)

I have a couple of questions:
1.Will the Pi be able to power all of this?
2.Can the Ground somehow receive more than 3.3V and fry? I don't see how, but who knows.
3.Can all of this supposedly draw more than 300mA at one point and shut down the RPi?
4.It says on the servo that max mA draw is 550. Can I put a resistor on the 5V wire which is used to power it to prevent this from happening?
5.Would it be safer to have an external power source? I'd prefer not to if I can avoid it.

Power Draw:
15mA Draw for the Distance Measurer.
No idea how much is needed to power the logic in the L298N.
Servo Standby 8mA. Max 550mA / 25 Ohms = 200mA. I think that's how it works.
The RPi has 16 or 17 usable GPIO pins and all of this should only take 9 if I'm correct. 6 For motors, 1 for trigg, another for trigg and 1 for echo.

Yeah, that's pretty much it. Thanks for reading. I could

Tarcas
Posts: 741
Joined: Thu Jan 09, 2014 5:38 am
Location: USA

Re: Can this supposedly work?

Sun Apr 20, 2014 8:10 pm

I have a couple of questions:
1.Will the Pi be able to power all of this?
It won't power the motors and servos. You'll want a separate power supply to drive those.
2.Can the Ground somehow receive more than 3.3V and fry? I don't see how, but who knows.
Ground is ground. It's going back to the 5v power supply. You need to avoid putting 5v into the GPIO pins, but ground can sink 5v. Also, tie the ground for the Pi to the ground for your motors (both DC and servo) or you'll have issues controlling them properly.
3.Can all of this supposedly draw more than 300mA at one point and shut down the RPi?
You can't source nearly that much from the Pi's GPIO. You'll need a separate power supply for the other devices.
4.It says on the servo that max mA draw is 550. Can I put a resistor on the 5V wire which is used to power it to prevent this from happening?
Sure, putting a resistor would reduce the power it would take... but it would probably also prevent it from moving. A separate power supply will solve this problem as well.
5.Would it be safer to have an external power source? I'd prefer not to if I can avoid it.
Not just safer. Necessary. Sorry.

Power Draw:
15mA Draw for the Distance Measurer.
Hopefully this is being powered from the 3.3v or 5v rail and not from a GPIO pin, as it's very near the limit for a single GPIO. Also you have a max current sum for all GPIO of 50 mA, and this will seriously eat into that.
No idea how much is needed to power the logic in the L298N.
No problem, unless you're using several of them. You'll be powering it from a power rail and not the GPIO pins, so you're ok. Also, remember to tie the motor ground to the Pi ground. (Both ground wires go in the same pin on the L298N.)
Check out this video for more info on using an L298N board with the Pi.
Servo Standby 8mA. Max 550mA / 25 Ohms = 200mA. I think that's how it works.
The RPi has 16 or 17 usable GPIO pins and all of this should only take 9 if I'm correct. 6 For motors, 1 for trigg, another for trigg and 1 for echo.
17, plus 4 more if you solder on the second header on the back.
Remember that you have a 50mA current limit for the sum of all GPIO pins. Each pin, however, can only source or sink 16 mA.

BMS Doug
Posts: 3824
Joined: Thu Mar 27, 2014 2:42 pm
Location: London, UK

Re: Can this supposedly work?

Sun Apr 20, 2014 8:28 pm

As Tarsus says, you need more power. MOAR POWER!!!!

To avoid extra batteries you could get a 5v UBEC to drop the voltage down from 12v to 5v.
Doug.
Building Management Systems Engineer.

Aquse
Posts: 2
Joined: Sun Apr 20, 2014 3:09 pm

Re: Can this supposedly work?

Sun Apr 20, 2014 10:28 pm

Thanks to you both for replying and taking the time to answer these basic questions. It looks like all of my problems can be solved by getting a UBEC or some more batteries to power the servo as well. And maybe also to power the distance module since it's so close to drawing 16mA from the 5V. And I forgot to ground l298n to the battery as well on the diagram. Same will have to happen to the servo.

Oh, and I'm also assuming that 16mA limit applies to the 5V pins, but I'm not sure.


Thanks.

User avatar
joan
Posts: 14935
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Can this supposedly work?

Sun Apr 20, 2014 11:04 pm

Aquse wrote: ...
Oh, and I'm also assuming that 16mA limit applies to the 5V pins, but I'm not sure.
...
The 16mA "limit" applies to the gpios only, not the 5V rail.

Tarcas
Posts: 741
Joined: Thu Jan 09, 2014 5:38 am
Location: USA

Re: Can this supposedly work?

Mon Apr 21, 2014 2:24 am

joan wrote:
Aquse wrote: ...
Oh, and I'm also assuming that 16mA limit applies to the 5V pins, but I'm not sure.
...
The 16mA "limit" applies to the gpios only, not the 5V rail.
Right. the 5v rail, as far as I know, is limited only by the 1A polyfuse on the MicroUSB port and the rating on your power supply. If you're backpowering it, you bypass the polyfuse. This might sound like a workaround to that limit, but if you're at risk of hitting that limit, it's more like sticking a penny in your fusebox. Yes, it'll keep the fuse from blowing, but you're likely to melt or burn something else because of it.

You can go ahead and power your sensor and the L298N from the 5v rail if it's easier (which I expect it is.) However, if the Pi keeps rebooting unexpectedly, it may be because you're overloading that polyfuse or your power supply. So bear that in mind and if it happens, and one thing to try is externally powering those devices. Especially if you have several sensors or H-bridges.

Since I'm on the subject and you didn't mention what you're using, we all recommend that you use a power supply rated to a minimum of 1A. More is good as they often can't maintain the load that they claim at the correct voltage, but the Pi will only draw up to 1A due to the aforementioned polyfuse so getting one rated to, say, 2.5A won't do you any more good than one rated to about 1.2A. You've probably seen this before though if you've done your homework on the RasPi.

Return to “Automation, sensing and robotics”