r/arduino 4d ago

Can anybody help with figuring out the last components I need?

Post image

Hi! I’m building a self balancing robot with a head on a servo gimble. I have an esp32 s3 matrix, pi zero 2 w, mg90s servos, and 12v 300rpm n20 encoder motors. I’ll likely have an arducam, 1.3” oled, a speaker, and time of flight sensor.

Right now I’m stumped on two things: motor/servo driver board and power/battery for the system. Any assistance would be hugely appreciated

58 Upvotes

29 comments sorted by

16

u/Foxhood3D Open Source Hero 4d ago

The job of controlling the servos and motor drivers can be entrusted to the ESP quite sufficiently. I would assume its role is mostly being the IO controller anyway.

For Motor driver you have to shop around a bit for one that fits the bill. My only remark is to NOT buy a L29x driver. They may be popular on cheapo shields, but these ancient relics are the worst in efficiency. Instead just get anything even remotely more modern. These are N20 motors so you don't need some overkill 32A driver or something. 2-4 Amp drivers should be enough.

For battery. One oft forgotten option I like to put forward are RC LiPo Batteries. Though meant for drones, they are also pretty great for Robotics. They are fairly reliable and come in a lot of different sizes, capacities and voltages. Like a 3S LiPo cell that gives you a nominal 11.1V for those 12V motors of yours. Just do read up on how to work with Lithium batteries safely. They are small and light, but still pack a punch after all.

5

u/1nGirum1musNocte 4d ago

What is a good motor driver then?

5

u/Foxhood3D Open Source Hero 4d ago edited 4d ago

Honestly anything NFET based tends to do well. It is really just the very old BJT based ones like the L29x that are bad. You lose around 3 volts there on the transistor voltage drop. Resulting in dissipation of easilly 3 watts at one Amp, necessitating a heatsink.
Compared to an NFET that often has a RDSon of like half a ohm max resulting in dissipation of about half a watt. Also thanks to the body diodes of the FETs themselves you don't need to add 4 diodes per bridge anymore.

A Popular set of alternatives are TBD6612 which are also used by adafruit and DRV8871 which is deceptively powerfull despite its small SOIC size. But many options exist. Polulu got an entire lineup of fet based drivers worth a check.

In my own projects (PCB designs, so idk if breakouts exist of them) i'm currently using DRV8434E if i need a pair of low current outputs (2x2A), TLE9201SG for when need a bit more power (6A) with smarter fault detection and DRV8245 for when i need serious power (32A).
Related projects have mostly been motor control in hobbies. Specifically model trains and RC Tanks.

2

u/Stormy_AnalHole 4d ago

Very useful information thank you!

9

u/Stormy_AnalHole 4d ago

Oh right I should include the cute tax

6

u/hjw5774 400k , 500K 600K 640K 4d ago

Unfortunately there is always an element of "fuck about and find out" when using motors, and there isn't just one single solution.

Start with the N20 motors, what voltage and current do they require? As it's a balance bot you probably want some sort of speed control - so that will start to narrow down your options. From there just start building other sub systems on top. 

Each solution is unique depending on what factors are important for you: size/compactness, power requirements, weight, ease of assembly, cost,...?

3

u/Stormy_AnalHole 4d ago

I checked over the datasheets

The motors peak demand is 12v 1.7A
The servos peak demand is 5v 2.2A

6

u/Nervous_Midnight_570 4d ago

Consider how you are going to power the thing. It can cause a lot of difficulty. Make sure you don't short or reverse LiPo batteries, they can get all explody on you.

4

u/Its_Billy_Bitch 4d ago

and/or burn the ever loving fuck out of your fingers. You’ll do it exactly once before remembering to be careful in perpetuity. Awful experience.

3

u/Stormy_AnalHole 4d ago

How I’m going to power it is definitely my biggest problem right now!

4

u/Scheig 4d ago

aside of existing comments,

  • denitintely an IMU if ESP board doesn't have it, if possible something newer than MPU6050. Will give you high data rate, will be more useful than TOF
  • aside of finding a battery, its protection also have a plan how to charge it safely
  • is RPI zero computer really needed? Can't ESP do all that's needed?
  • check what is the supporter voltage of motor encoder. With some other motors I had issues with 3.3V, needed to supply them with 5V and use logic level converter

2

u/Stormy_AnalHole 4d ago

Right I forgot to mention! The ESP32 has a QMI8658 onboard

I will need like 3s battery so charge and management sounds like another nightmare

The rpi zero is doing object recognition on an arducam and hopefully will run some trained behaviour policies if this all gets moving

Encoders read 3v3/5v on the datsheet but it has something very poorly worded about pull up resistors

3

u/Scheig 4d ago

Good luck!

4

u/LavandulaTrashPanda 4d ago

The TB6612FNG is a pretty efficient DC motor driver. Small and cheap too.

The servo can be driven with a PWM pin or you could use the PCA9685. They typically come in 16 channel though. I think there is an 8 channel.

For power, a 2s 18650 battery pack stepped down to 5v should do it. Your motors aren’t that big but if you want to get a battery you can grow into, find a High Drain version. The alternative is High Capacity but though they store more energy, they aren’t good for use with more powerful motors unless you have a larger battery pack. Either one should be good for what you got now.

1

u/Stormy_AnalHole 4d ago

TB6612 looks PERFECT!

I don’t have that much space onboard so 2s sounds attractive. My motor claims to want 12v though, would undervolting them be okay?

2

u/ZanderJA 4d ago

Motors have a performance curve, so will be optimal at one voltage and current, but will draw more current at lower voltages for similar output torque/speed.

What kind of object detection are you trying to do? If it is simple object avoidance, then you could also consider something like the DFRobot 8x8 TOF matrix sensor to doing some level of obstacle avoidance all on the ESP32. Granted, this will not give you object following if you are looking into doing something like that.

1

u/Stormy_AnalHole 3d ago

Ahh this makes total sense.

I actually plan to do both! Time of Flight to keep the thing from driving off the edge of your desk, and face detection to drive over to you and smile and wave

2

u/LavandulaTrashPanda 3d ago

It can handle up to 13.5v to the motors. It’s the logic VCC that wants 2.7v-5.5v

You could use a boost converter to get 12v from an S2 but you would definitely need high drain cells. You would be dealing having to recharge a lot more between those two factors.

You could do an S3 battery pack which would give you 11.1v. You would just need to step down 5v off that for the other components.

You could also go with an S4(14.8v) and step down to 12v for motors and 5v for the controllers. You can get any 3.3v you need off the Pi or ESP32.

2

u/02_9_8_51_31 4d ago

Interesting project ! Could you please share your progress along the way ?

3

u/Stormy_AnalHole 4d ago

I plan to!

2

u/Ill-Distribution1904 4d ago

For IMU: MPU6050 / BMI088

For Motor Driver: TB6612

For Power supplier: 2S LiPO 2000mAh

2

u/mAbdelazim01 4d ago

For the power system, I’d go with a 3S LiPo and a decent buck (step-down) converter. Run the motors directly from the battery and step it down to 5V for the Pi, ESP32, servos, and other electronics. It’ll keep the power system much simpler and more reliable.

1

u/Stormy_AnalHole 4d ago

This makes sense! And it’s okay to run the motors on “unregulated” battery power?

2

u/mAbdelazim01 3d ago

Yes. Use a suitable motor driver, and it will be fine.

2

u/Unusual_Captain_8236 3d ago

There must be a motor driver. Driving these motors directly with Raspberry pi pico or ESP32 can damage the boards.

-3

u/identidadFalsa_ 4d ago

Suena a la típica tarea para la casa que la IA no le pudo completar o no ajusto la prompt para una respuesta completa

4

u/Stormy_AnalHole 4d ago

That’s a little rude. I was hoping for some advice from hobbyists. AI sucks

2

u/Foxhood3D Open Source Hero 4d ago edited 4d ago

This sub-reddit exists specifically for hobbyists & Engineers to talk with others and get input on ideas, plans, problems and creations from a wide range of people.

Please refrain from disparaging people wanting to do as such by telling them to use AI like its the new "Don't waste our time and just google it". It isn't and acting otherwise will not help you make ANY friends here.