-2
\$\begingroup\$

I have some problem with water pump.

So I use atmega32a and 5v relay module to turn water pump on for 5 second, but in reality the water pump can't last for 5 second. Just after water pump goes on, atmega32 has a strange behavior that makes another component like servo move randomly.

Components I use:

  1. Atmega32A
  2. Relay module 5v
  3. Submersible water pump 5v
  4. Micro Servo 4.8v

I already tried this:

  1. Separating power supply
  2. Change relay with transistor
  3. Change microcontroller

Here is the schematic & relay: Schematic Breadboard I really need your help to solve this problem, and I'm sorry for my bad English. Thank you :)

\$\endgroup\$
  • 1
    \$\begingroup\$ According to your schematic, the contacts of your relay aren't effectively connected to anything. \$\endgroup\$ – Dmitry Grigoryev Jul 10 '17 at 12:09
  • \$\begingroup\$ @DmitryGrigoryev hi, i connect water pump to the relay NO contacts. \$\endgroup\$ – sansan dj Jul 12 '17 at 6:51
  • \$\begingroup\$ -1 for false schematic showing the relay coil connected directly to the MCU pin when that is not what you claim in words to actually have. Posting false information wastes everyone's time including your own. \$\endgroup\$ – Chris Stratton Aug 10 '17 at 13:37
4
\$\begingroup\$

It looks like you are using a 5 volt submersible water pump but you haven't used a flyback diode so this is something to add - it will prevent a large back-emf when the pump turns off (the relay contact opens).

However, it is likely that your main problem might be a dip in the power supply voltage when the pump is activated. This might be a very small and transient dip but, it could cause t your micro to reset because it looks like it is sharing the same 5 volt power line.

Add decoupling capacitors and, in particular add one close to the relay pump circuit so that any sudden impulse of current is largely kept local to that part of the circuit.

Bread-boarding techniques and bad circuit layout can also contribute to this problem.

\$\endgroup\$
  • \$\begingroup\$ Thank you for your answer, i still having some problem with it. Im just add decoupling capacitor just like what you said before. It work perfect sometimes, but sometimes it still making strange behavior like relay moving randomly, and etc. \$\endgroup\$ – sansan dj Jul 12 '17 at 6:48
  • \$\begingroup\$ That might be a breadboard/layout problem. Post a picture of how you have implemented this. \$\endgroup\$ – Andy aka Jul 12 '17 at 7:04
  • \$\begingroup\$ I just post the picture. Is the decoupling capacitors good ??? i use 100nf capacitor for decoupling. Thank you :D \$\endgroup\$ – sansan dj Jul 12 '17 at 7:28
  • \$\begingroup\$ It's a breadboard problem, no doubt. Wires are going everywhere. This is a real problem facing guys like you - I never use breadboards for this reason - I go straight to PCB and still there will be problems but many, many fewer. Try adding a 100 uF capacitor to the power lines near the relay as a last resort else you might just have to learn how to wire these things up to minimize induction and spike problems. \$\endgroup\$ – Andy aka Jul 12 '17 at 7:50
3
\$\begingroup\$

I think your main problem is that you have connected the relay module directly on a microcontroller pin.

Check the datasheet of the relay. It says the coil resistance is 70Ω. That means when you set the PC4 of the Atmega to LOW state, then the current that this pin has to sink is 5V/70Ω=~71mA. This current is more than the max current that can go out or come in a pin of the Atmega, which is 40mA according to the datasheet.

To solve this, use the microcontroller pin to turn-on/off a MOSFET or BJT driving circuit. The transistor can be easily set to allow the current needed to properly operate the relay.

But as AndyAka says, there are also other couple of issues (like missing decoupling capacitors) that could cause dips in the power supply. And don't forget the flyback diode!

\$\endgroup\$
  • 1
    \$\begingroup\$ Thank you for your answer, but the relay already have a transistor. I just add decoupling capacitor on VCC and Relay Circuit. After that sometimes it work perfect and sometimes it still resetting or just making strange behavior. \$\endgroup\$ – sansan dj Jul 12 '17 at 6:47
  • \$\begingroup\$ @sansandj: And how should I know that it has a transistor on-board? You didn't give us the type of the module, just a photo of it. \$\endgroup\$ – nickagian Jul 13 '17 at 7:22
  • \$\begingroup\$ sorry it was my bad :( \$\endgroup\$ – sansan dj Jul 27 '17 at 3:41
  • \$\begingroup\$ First off all, cease the design with breadboard, it s not good at all to have all the capacitance and inductance in your circuit. Secondly try some decoupling caps close to the uC power pin, in the worst case add ă ferrite bead in series with uC power pin and a capacitor after it. \$\endgroup\$ – Stefan Merfu Aug 10 '17 at 13:41
0
\$\begingroup\$

You should not use the same voltage regulator that powers the MCU to power the motor (pump and servo) loads. Motors draw high currents, both when starting and exceptionally so when stalled, and microcontrollers do not tolerate even brief power dips without at best restarting. Therefore, they need separate voltage regulators or extreme overdesign - but separate is easiest.

You should also consider your upstream power source. Let us hope it is not a tiny 9v transistor radio battery! Your upstream source will need to be able to supply all of the peak downstream loads, without sagging below the minimum input voltage of the regulator.

Additionally, powering high current devices from a linear regulator is wasteful - in the system you have designed, approximately 44% of the power consumed will be used merely to generate heat in the regulator. Linear regulators can be more efficient.

Ultimately, the likely best solution is to revise your system to use a power source more suitable for the motors. For example, a sturdy 5v supply, or perhaps 4 AA batteries. You could then replace your 5v microcontroller with a modern 3.3v one, and power it with a low dropout regulator running from that 5 or 6v input. If you need more headroom for brownout protection, most modern MCUs can be run off even less than 3.3v, so you might use a 3v regulator or even a 2.8v one - check the data sheet. Even your ATMega32A can do this, if you operate it at a slower clock and configure the fuses for a lower brownout detection threshold.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.