Need help to Review my Circut Design :)

Hi Folks I am beginner to ESP 32 for my robot I am getting started with ESP32
Have watched tutorials for each module I am using and combined them to make this circuit
i know this is very ambitious project for beginner lik me but i couldnt help myself :slight_smile:

Here my circuit DiagramESP32 Connections.fzz (216.5 KB)

in My project I need to connect

ESP32 as main Controller

1. 10 Small LED RGB 5mm  5V (Planning to use PCA9685 and 9V battery switch button)
	All LEDs  will be on all the time or some of them will be on
	
2. 4 Stepper motor  SG90 9gm ((Planning to use 2nd PCA9685 and 9V battery switch button)
	There won't be any load on servos and will be off when reached at certain angle 
	
3. Two LM2596 step down from 9v to 5.5v for PCA9685
	As PCA9685runs on 5.5 V
	
4. Two DC motors 6v  (Planning to use L298N as motor Driver )
	ESP32 will be powered by 5V pin of L298N and connected to Vin of ESP32
	Two 9V batteries (18V total) will be used with switch button on off
	Dc motors for wheels, it has to carry load of the whole circuit and robot body(~400gm), speed is not important 
	Hence I have decided to use gear reduction 100rpm or 300rpm
	
5. Control over WIFI/Bluetooth, by Android app(which I can develop from tutorials)

6. 1 Speaker  8 ohm and MAX98357A as audio amp module
	with 2 WAV audios (each being ~1 min long) stored in ESP32 as it has 4MB memory

7. I am planning to control ESP32 via Bluetooth or my home WIFI

My doubts
1. Is one ESP 32 will enough for this or do I have to use 2 in I2C
2. Do I have to connect other components registers capacitors for better current management if yes where
3. How do I calculate how much current my circuit will require, I am okay with recharging batteries after ~40min of usage
4. Are all grounds are connected well in my circuit diagram
Please let me know if there are any enhancements that I could do :slight_smile:

First, your sketch appears to be corrupted:

The line circled in blue should say “Routing completed”. The fact that it doesn’t even though there are no unrouted connections indicates corruption. The only known cure is to delete all the wires and rewire the sketch. As well at least these two wires (circled in red here) are not connected. The ground wire is not connected because the connection point is red (rather than green indicating connected as the red and blue wires are.)

While I’m not that familiar with ESP32s I think one should do you. I believe the ESP32 is usually 3.3V which means you may need level translators for the 5V parts though.

Most of the boards should have the required bypass capacitors on board so you shouldn’t need to add extras.

The best way is to wire the entire circuit and measure the current it draws when working with an ammeter (that isn’t entirely accurate, because various things such as load on the motors may draw more current!) Otherwise you need to read the data sheet for each component and see what its max current draw is and add them all up.

No. You need all the grounds connected together. At present the grounds are not all common and the circuit will not work correctly.For instance there is no common ground between the ESP32 and the motor driver and thus the ESP signals will not drive the motor driver. The motor driver ground needs to connect to the ESP32 ground to work.

The first thing I would suggest is replace the motor driver. The LM298 is transistor output and has about a 2V drop in the transistors (against perhaps .2V drop in a DMOS output motor driver.) That wastes battery power. You need to know how much current the gear motors draw (it should be in their data sheet) to know what motor driver would be suitable for them. Next, in battery power applications, you want to reduce both weight and current draw to maximize battery life. In this case as far as I can see a single pca9685 should do. It has 16 channels and that should do for 4 servos and 5 (or 10) leds. I expect your leds will need a series current limiting resistor to set their operating current. The pca9685 will run on 5V (5.5V is likely the maximum value, not operating!) so you don’t need the to step down switchers. You would also be better to run off a single (possibly larger) battery. You want to supply 5V (and 3.3V if required) via the step down regulators (which are around %80 efficient) rather than via the linear regulator on the motor driver (around %30 or less efficient which wastes battery capacity.) As well your audio amplifier requires a power source (likely to the unconnected Vin pin) presumably 3.3 or 5V (but perhaps higher.)

Peter

1 Like

Thank you so much for this very detailed reply Peter.!! I really appreciate you taking time for replying :slight_smile:

From your reply I gather that I need to work on following things:
1. Connect all the grounds (Working on it)
2. Correct my Circuit diagram (fixed it : Servos Connections were off).
image
3. Level translators for the components 5V to 3V vice versa (may be using TXS0108E).
4. Use step down 5V to power Motor driver rather than liner regulator of motor driver.
5. replace the motor driver to DMOS output motor driver for efficient power use.
The 2 Motors which I am using has specification as follows
• Operating Voltage: 3 to 12V
• Current (without loading): 40-180mA
• RPM: 100 rpm
• Output Torque: 0.8 kg cm
With this what would be the best Motor Driver for me? considering total body weight of ~500gm
Or any refrences for me to go through
6. Use only 1 PCA9685 as it will be enough for 4 servos and 10 LEDs
7. Series current limiting resistor for LED
8. No need to have step down convertor for pca9685 as it will run on 5V (5.5V is likely the maximum value, not operating!)
9. audio amplifier requires a power source.

I will update my Circuit Diagram once I will complete above requirements and post it again to get your help again for the review :slight_smile:
Please let me know if I missed anything.

Thank you so much
Have a great day ahead !!! :slight_smile:

I think you may be hitting a Fritzing bug with connections not on the breadboard. I think it is fixed in 0.9.5 but I’m not sure (it still happens on my version of 0.9.5, but it is fairly old now and may be pre fix). In any case routing complete is what you want.

You need to be careful with the TXS level translators as they are load dependent. If the load gets too high they oscillate and malfunction. You may not need level translators at all if the ESP pins you use are 5V tolerant (I think at least some pins on the ESP are, it isn’t clear on the board you have as their web page doesn’t have any specs on the board although they may be in the user manual which you have to request.) Usually a 3.3V output will drive a 5V input, it is 5V in to a 3.3V input that is often fatal. To go that direction a 74ahc125 will do. It’s inputs are 5V tolerant (only on the ahc version, not the hc or any of the rest though!) when powered from 3.3V so they will translate a 5V input to a 3.3V output at full speed.

The problem here are the weasel words ("(without loading)" in this case!) There is usually another specification called stall current which occurs when the motor is powered but the shaft (i.e. the wheel it connects to) is stopped. That will be much higher than the no load run current (as will the current under load such as when moving your 500gms) and is what your motor driver needs to be able to source (or limit the current it will supply to the motor, which may be easier when dealing with the stall current.) Some of the DMOS motor drivers have an optional current sense resistor and current limit setting which may be helpful here.

I’m a poor source for advise here as I don’t make robots. You need one that is capable of taking the peak current that your motor needs during operation (and probably a current limit to avoid overload during a stall.) I expect your best bet would be to get all the specs on your motors (if possible, many of them don’t have any!) such as stall and expected run under load currents, and then ask in a robot building forum for advise on a suitable motor driver. That way you should get answers from people that have used the motor driver, ideally with the motors you want to use. You then need to find (or get one of us to make) a Fritzing part for the selected motor driver.

Yes, as well I see the LEDs are miswired on your sketch. The LEDs need to connect through a 220 ohm or so resistor to the PWM pin, not the 5V pin (if you don’t need to control the brightness of the LEDs you don’t need the PCA9685 for the LEDs just connect them through the resistor to 3.3V or 5V directly, 3.3V being preferred as it causes less power loss in the current limiting resistor which is good for battery life. You may need to change your batteries as well. 9V batteries are usually around 150ma hours (i.e. they will in theory provide 150ma for an hour.) I expect you need a lot more current than that. You would probably be better with either 4 (~4.2V) or 6 (~7.2V) 2.2A hour AA size NMIH cells or 2 18650 LIPO cells (~ 7.2V) (although be careful with these, as they explode if shorted!) and possibly a pair of boost/buck switching regulators to provide 5V and 3.3V efficiently (and maybe a third one for 6V for the motors if 5V won’t do for them.) A couple of amp hour battery is more likely to be able to last the 40 minutes you want (although they are also heavier I expect.)

Always a good idea, more eyes catch more errors and everybody learns :slight_smile: .

Peter

1 Like