ESP32 with 2 relays and 8 pumps (cocktail bot)

my group and I have been trying to build a cocktail-mixer for a school project. We looked at this project as a general guide: Cheap portable Cocktail maker Barbot with App! - Arduino Project Hub (however with not the same parts or wiring etc)

The goal of the mixer would be connecting to the ESP with an app over bluetooth and selecting from a list of predetermined drinks, but at this point we'd be happy just to get the pumps working correctly.

We've progressed to the point where we have an ESP32 hooked up to two relays, each with four outputs connected to 24V pumps and when trying to run a simple test code to individually run the pumps it just activates some of the pumps for a random amount of time. This leads me to highly suspect that it's some kind of a hardware problem or the shitty relays with no documentation that our teacher provided us. Also, a quirky issue we discovered is that once we turn the power on, the ESP32 just completely stops responding in the IDE-software. If the power isn't on, we can connect to it via bluetooth and send commands etc.

Here's an imgur album with some photos of the wiring, parts etc: Cocktail thingy - Album on Imgur

The project is supposed to be done soon and we've hit a deadend, and even the teacher doesn't know where the problem is haha. Any help or pointers would be appreciated! Please let me know if you need any more details.

We need to see your code and a proper schematic of the project, hand drawn if necessary

Please follow the advice given in the link below when posting code, in particular the section entitled 'Posting code and common code problems'

Use code tags (the </> icon above the compose window) to make it easier to read and copy for examination

Let you teacher know you'll not be making the deadline.

You are powering a 5V relay module with a 3.3V ESP32, correct? And powering the 5V relay module with 3.3V you are experiencing issues, correct?

The ESP32 cannot directly drive relay's, I use relay modules with an opto-isolator that can be driven by a 3.3V signal.

As a note, your description of the issue describes a power issue.

Running motors through a breadboard is not going to work.

Looking at the photos briefly (which should have been attached to your post so we don't have to follow links to dodgy image hosting sites) there are no relays. You have 2 X L298N motor driver modules, each can drive 2 motors. How are your other 4 pumps driven?

EDIT: I get it. Since the pumps are not bi-directional, you have 4 pumps attached to each L297N module.

Well, now you know they are not relays but motor drivers, perhaps that will help. The motor drivers will have a direction and a speed control pin for each of a pair of motors. Because you are using them to drive 4 motors each, you can only have 4 out of 8 pumps running simultaneously. That may be fine for your project. For a pair of pumps attached to the outputs on one side of an L298, you need to use the direction pin to decide which of the 2 pumps you want to run and the speed pin to switch that pump on and off.

I think this was it, we switched to an Arduino Uno and it works like a charm. Kinda weird that the teacher advised us to use the ESP with the 5V relays, but now we got the system working at least. Thanks for your reply!

Sorry, first time poster!

We had no clue they weren't relays! My group has no prior experience with building anything, and we just took the teacher at his word when he said they were relays. How did you know the name of the motor driver module? We tried googling every word written on it and couldn't find any technical specs.

Thank you a lot for the info, that's going to help a lot with the coding part of the project. We're planning to have each pump working after each other, so the limitations sound fine. We switched from the ESP32 to an Arduino Uno and we got the pumps working :slight_smile:

As a note the ESP32 may be defective with having to drive 5V.

I recognised the components and layout of the board. They are commonly used with Arduino to drive motors for robots/vehicles. They are not the most modern or efficient motor drivers, an old design. But ok for your project I guess. If you look at the big chip - the one sticking upright from the board, with 15 legs, bolted to the large black heatsink, you will probably see the "298" code there.

They are called "H-bridge" drivers, which is the name given to drivers that can control the speed and direction of motors. L298 contains 2 X H-bridge circuits, so can drive two motors independently in different directions at different speeds. Because you never need to run your pumps in reverse, you can attach 4 pumps instead of 2 motors, but only run 2 of them at the same time.

Why is that? You cannot tell the H-bridge to pull both lines HIGH?

@Paul_B you are right as always, I should have checked the data sheet again. I thought I remembered the chip having a direction and speed(PWM/enable) pin for each H-bridge. But in fact it has 3 control pins for each H-bridge, so it would be possible to independently run 4 pumps at once.

That - was a complete fluke! :upside_down_face:

I have never looked (AFAIK) at that chip since 1} I don't think I have one, 2) I have little desire to reverse motors at this point and 3) I seem to recall it has terrible press here. :grin: