Flobater
Posts: 11
Joined: Sun Oct 07, 2018 3:41 am

Robotic

Sun Oct 07, 2018 3:46 am

Hi guys!
I am totally new to the deal with robotics and coding so forgive me if I don’t sound like an expert!
So i have 12 dc motors that they are 3v each I believe i tried to use arduino before, it works but i just want to move to rp because it uses python which is way way easier to deal with.

So can I still connect 12 motors to the raspberry pi? And if so which would would be the best? And do i need h-bridge and l293d?

Please i am really open to all your suggestions and recommendations, and if you have any product that will help please give me the link or the full name so i can find it.

Thanks so much, appreciate your help

User avatar
OutoftheBOTS
Posts: 674
Joined: Tue Aug 01, 2017 10:06 am

Re: Robotic

Sun Oct 07, 2018 10:18 pm

You will need a h-bridge for little motors like these I would use a L9110 like this https://www.aliexpress.com/item/B37-1pc ... autifyAB=0

You will need 2 pins per motor were I use 1 pin as direction pin and the other pin as PWM speed control

Creating 12 PWM channels with RPi might be a challenge and not sure of how many the PiGPIO library can create.

Flobater
Posts: 11
Joined: Sun Oct 07, 2018 3:41 am

Re: Robotic

Mon Oct 08, 2018 4:10 am

alright perfect, is there any source that can show me how to connect this L9110 to Hbridge? and like how i would connect all these wires to the RPI?
and do i need 6 L9110? and does this L9110 gets connected to Hbridge and from the Hbridge to the RPI? or just directly from the L9100s to the RPI?


thanks so much:))))))

User avatar
OutoftheBOTS
Posts: 674
Joined: Tue Aug 01, 2017 10:06 am

Re: Robotic

Mon Oct 08, 2018 7:09 am

each 1 of those little h-bridge boards have 2 L9110 chips on them so they r a dual h-bridge and will drive 2 motors.

simple explanation here https://raspberrypi.stackexchange.com/q ... y-pi/67217.
L9110.JPG
L9110.JPG (97.23 KiB) Viewed 794 times
You can see by the logic truth table from the datasheet that when ever both inputs r the same (both high or both low) then the outputs to the motor are low (turned off) and when ever the inputs r different the the motor turns but depending upon which of the pins is high and which is low what direction the motors turn. So you can use 1 pin as a direction pin and the pother as a speed pin with PWM. When the dir pin is low the motor with get power during the on part of the duty cycle of the speed pin but when the dir pin is high the motor will get power when the PWM speed is low so for for a high on dir pin the speed will be inverse on the duty i.e if dir pin = 0 then speed = duty of speed pin, if dir pin = 1 then speed = 100 - duty of the speed pin.

For wiring you will need to connect all the IN pins to RPi GPIO pins and the OUT pins to the motor, the power pin will goto your motor power supply(I assume a battery) and you will need a common ground from H-bridge to motor power supply and RPi

Brandon92
Posts: 532
Joined: Wed Jul 25, 2018 9:29 pm
Location: Netherlands

Re: Robotic

Mon Oct 08, 2018 9:43 am

To make a small note. You can not use the 3.3v rail from your Rpi to power your motors. So, you need a extra power supply for that. And how much current draw you motor?

Flobater
Posts: 11
Joined: Sun Oct 07, 2018 3:41 am

Re: Robotic

Mon Oct 08, 2018 8:38 pm

https://www.robotshop.com/community/for ... it/28623/2

here is a chart showing the current of the motors when there is heavy, and no load.
so i am going to connect the RPI to my computer, how can i connect all the 12 motors to 1 power supply? and how much should be the voltage and current should i use?

Note, i probably won't use more than 2 or 3 motors at the same time, that if i needed to use them at the same time.

so all i need is just to connect the Rpi to the motors and the motors to a power supply so i can just write the code for it and make it work the way i want. but since they are 12 motors with low voltage i donot know how to connect them? or what adapter should i use?



thanks so much for your help!! i truly appreciate it!

User avatar
OutoftheBOTS
Posts: 674
Joined: Tue Aug 01, 2017 10:06 am

Re: Robotic

Tue Oct 09, 2018 4:25 am

There are 1 cell LiPo batteries designed for drones that can put out decent amps. These batteries have a nominal voltage of 3.7v but the H-Bridge will have a forward voltage that will drop that slightly so it should be good to run those motors on.

Flobater
Posts: 11
Joined: Sun Oct 07, 2018 3:41 am

Re: Robotic

Tue Oct 09, 2018 2:55 pm

that actually sounds better than connecting it to an adapter. what should be the current be though?
https://www.amazon.com/260mAh-Battery-J ... ries+2+amp

would that be a good choice?

thanks

User avatar
OutoftheBOTS
Posts: 674
Joined: Tue Aug 01, 2017 10:06 am

Re: Robotic

Tue Oct 09, 2018 9:03 pm

They will likely get the job done but won't last long before going flat as they r only 260mAh. U will probably want to get a battery monitor because if you run the batteries totally flat it tends to damage them and also can cause them to catch fire when you try to recharge a totally flat battery. Some thing like this https://www.aliexpress.com/item/Lipo-Ba ... autifyAB=0

You can work out how many max amps a battery is rated for by looking at C rating. Max amps = C * capacity i.e this battery has a 30c rating and capacity of 260mAh (0.26Ah) so then max amps = 30 * 0.26 = 7.8A. I find manufactures like to over exaggerate the specs of their batteries so I like to make sure that I use something way over spec.

My advice would be see if you can find a larger battery as it will both last longer before going flat and will have more margin fro max amps and run much happier.

Flobater
Posts: 11
Joined: Sun Oct 07, 2018 3:41 am

Re: Robotic

Thu Oct 11, 2018 7:27 pm

https://www.amazon.com/dp/B07C3D1N2P/re ... 489532c619

do you think these are good enough?
they have 550mAh and 50c= 27.5A

use one of these two as a charger?


https://www.amazon.com/dp/B074M6G2MD/re ... 489532c619

or

https://www.amazon.com/dp/B07CJ5ZJ1V/re ... 489532c619



and use that as battery monitor?

https://www.amazon.com/eHappyMaker-Cell ... +8S+F00872



but how can i connect these batteries to the l9110 h bridge?

should i use these and connect them to the hbrdige by jumper wires?

https://www.amazon.com/dp/B06WGM9W7S/re ... B2NWNKDSBL


thanks so much
Last edited by Flobater on Thu Oct 11, 2018 7:50 pm, edited 3 times in total.

Brandon92
Posts: 532
Joined: Wed Jul 25, 2018 9:29 pm
Location: Netherlands

Re: Robotic

Thu Oct 11, 2018 7:42 pm

How long do you want to last the product on one battery charge. And I believe that only 3 run motors at the same time?

Flobater
Posts: 11
Joined: Sun Oct 07, 2018 3:41 am

Re: Robotic

Thu Oct 11, 2018 8:14 pm

I was going to connect a battery for every 2 motors and around 5-10 minutes max

Brandon92
Posts: 532
Joined: Wed Jul 25, 2018 9:29 pm
Location: Netherlands

Re: Robotic

Thu Oct 11, 2018 8:59 pm

Is there a specific reason for you to use in total 6 battery. In stead of one big one? Because I think one big one works also, and easier to manage and connect everything to each other.

Flobater
Posts: 11
Joined: Sun Oct 07, 2018 3:41 am

Re: Robotic

Thu Oct 11, 2018 9:09 pm

i mean is that possible? because i am going to have 6 hbridges L19110 how can i connect all of them to one battery?
because that will be way way easier and more efficient.

thanks

User avatar
OutoftheBOTS
Posts: 674
Joined: Tue Aug 01, 2017 10:06 am

Re: Robotic

Thu Oct 11, 2018 9:32 pm

You have a few options.

1. several batteries: This means you have to monitor several batteries, but the current draw is split up amoungst several batteries.
2. use 1 battery big enough: Thgis means you have to monitor 1 battery but it has to be capabile of suppying enough amps to run how ever motor r running at once.

I personally tend to use 1 battery that is capable of suppling the needs of the whole project as this is my preference.

I usually use a battery that is over spec for capacity and max amps as I find manufactures lie big time about the capabilities of their batteries and also batteries perform poorly when used at close to their max current draw.

The wires you posted look like what you will need to be able to connect to the batteries and you will need to also buy some dupont jumper wires for the H-bridge connection.

Do be very aware that there isn't a standard way that these batteries r wired up to the plug and can be wired either way. Check the polarity before connecting to anything. I have had projects running fine then the battery went flat so I changed it to another battery from another supplier and connected then the project smoked up because the new battery was wired the opposite way.

Also FYI if you connected 1 of those batteries you posted to the 5v rail (without connecting anyother power supply) on the RPi it will probably run the RPi. Although the RPi normally takes 5v it is in fact a 3.3v system and has an on board DC to DC buck converter to regulate the voltage down to 3.3v, so it is likely the 3.8v connected to the 5v rail will be regulated down to 3.3v to run the RPi fine but no promises :)

Flobater
Posts: 11
Joined: Sun Oct 07, 2018 3:41 am

Re: Robotic

Thu Oct 11, 2018 9:57 pm

omg thanks so much!!!! i am really sorry if i ask too many no sense questions, but i really like the idea of using just 1 battery just because it will be way easier and just 1 source to control! but how can i connect all the 6 L9110 H-bridges i have to just 1 battery source? and another question how much should be the voltage and current for this one battery? and for sure no more than 3 motors will run at the same time! and i am going to connect my RPI to my computer, so pretty much all i need is the power supply for the motors
thanks so much!!!!! :D :D :D :D

Flobater
Posts: 11
Joined: Sun Oct 07, 2018 3:41 am

Re: Robotic

Thu Oct 11, 2018 10:58 pm

another question should i use L298N instead of l9110 since my motors are small voltage but i think they need high current?

User avatar
OutoftheBOTS
Posts: 674
Joined: Tue Aug 01, 2017 10:06 am

Re: Robotic

Fri Oct 12, 2018 5:45 am

Flobater wrote:
Thu Oct 11, 2018 10:58 pm
another question should i use L298N instead of l9110 since my motors are small voltage but i think they need high current?
As you use a H-Bridge that can handle more current it has a higher forward voltage (forward voltage is how my voltage drop there is across the H-Bridge or voltage loss or voltage that is turned in to heat and burnt off)

The main advantage of the L9110 is it has a very small forward voltage of about 0.5v so super efficient.

The L298N has a hugh forward voltage of about 2.8v that's why you see most boards built with it have a really big heat sink on them as tons of the batteries energy will be converted to heat. To use a L298N u would need a much higher voltage battery as it has so much voltage drop. The L298N can drive motors up to 30v at 3amps continuous so really big motors but tends to just drain the hell out of batteries when trying ti drive small motors.

Another disadavtage of the L298N is most brads using this H-Bridge require 3 pins per motor as they use 2 pins for direction and then another pin as PWM speed pin where as the L9110 just uses 1 pin for direction and then 1 for PWM speed per motor.

The good thing about the L9110 is it is really really cheap if the motor over loads the H-bridge and burns it out then replacing it won't break the bank.

To power many motors from 1 battery you just need to run a power wire and ground wire from battery to every H-Bridge.

It is probably best to have separate power supply for the RPi from the motors as motors create inductive spikes that feed back and can damage the RPi unless you know how to build filters to stop this happening.

Flobater
Posts: 11
Joined: Sun Oct 07, 2018 3:41 am

Re: Robotic

Fri Oct 12, 2018 2:00 pm

Makes sense! Would the l9110 still drive the needed current? Or just 1amp?

Brandon92
Posts: 532
Joined: Wed Jul 25, 2018 9:29 pm
Location: Netherlands

Re: Robotic

Fri Oct 12, 2018 2:45 pm

The l9110 is capable of delivering a continuous current of 800mA. And it will except a current spike of 2A. But, for a short amount of time.
And it will provide that with the voltage drop, as already mentioned.

By the way, you use a computer. Why are u choosing for a battery and not a power adapter?

Flobater
Posts: 11
Joined: Sun Oct 07, 2018 3:41 am

Re: Robotic

Fri Oct 12, 2018 2:52 pm

alright perfect! just wanted to make sure it will work! i am going to test it anyways with 2 motors before i connect the 12 and see what happens!
and i need the battery as a powersupply for the motors not for RPI, i already have two adapters that can drive all the needed current and voltage! but i am just stuck at how ill connect those 6 hbridges to 1 powersupply, and once i figure this out i will probably use the adapter and not be worried about the battery getting flat. so yah, if you have any suggestions of how i can connect those 6 Hbridges to 1 powersupply?

Brandon92
Posts: 532
Joined: Wed Jul 25, 2018 9:29 pm
Location: Netherlands

Re: Robotic

Fri Oct 12, 2018 3:28 pm

As a slide remember. You can not use the power adapter and the battery at the same time. If you choose to use that kind of battery. Bad thing will happens. (You can't charge that type of battery in this way)

As for the connection, assuming that your power supply is the right one:
Place from the positive connection first a fuse. And then connect it to the power (vcc) of each motor driver drive.

You can connect the ground of the power supply also to each motor driver. And make one connection between the ground of the motor driver power supply and your Rpi.

You could make a paint drawing of this. So, we can see if we are on the same page.

User avatar
OutoftheBOTS
Posts: 674
Joined: Tue Aug 01, 2017 10:06 am

Re: Robotic

Fri Oct 12, 2018 10:35 pm

Flobater wrote:
Fri Oct 12, 2018 2:00 pm
Makes sense! Would the l9110 still drive the needed current? Or just 1amp?
Each H-bridge will drive that much current. If you are going to use 1 battery to run all motors then the battery needs to be able to supply enough amps to power all motors but you will be using a H-bridge for each motor so the H-Bridge only needs tpo be able to handle the current pulled by 1 motor not the total amount of current coming from battery.

So you will be within the specs of the L9110

Return to “Automation, sensing and robotics”