Errors caused by external power source for dosing pumps

Hi,
i built my own aqua-controller which includes following features:

  • PWM control of my LED lighting with three meanwell power supplies 4.5A / 24V and alltogether 17 constant current drivers with PWM
  • By using a ULN2003 I control three 24V Dosing pumps, also using the same power supply as for my LEDs
  • Controlling of my waterflow pumps by using this motor shield (which I built on my big shield) => using 2 external 12v power supplies http://schmelle2.de/wp/arduino/shields/jumping-ball
  • on board RTC with DS1307
  • 20x4 LCD
  • temperature control for water and air and led cooling
    Anyways, please find attached some pictures of my controller.

The problems I am facing now:
I yesterday tested my controller for the dosing pumps. Please see attached the schematics of this control.
I attached the LCD to my controller, a button to turn the pumps on and off and uploaded the code. So far everything worx, when switching the button, nothing bad/good happens. The LCD just works and shows the RTC.

Just as I attach the 24v power supply, my LCD kinda crashes and showe weird symbols. Restarted the arduino.
ok, now the 24v supply is attached, LCD works, dosing pumps attached, button attached.
When I know turn on the button my dosing pump starts working. Good so far. If I repeat it over and over again (on and off) first thing happens is that the LCD again kinda crashes and shows the weird symbols again.
However, I can still control the pump but the entire Arduino crashes after a few more switches and I have to restart the Board.

This is my little test code:

#include <WProgram.h>
#include <Wire.h>
#include <DS1307.h> // written by  mattt on the Arduino forum and modified by D. Sjunnesson
#include <LiquidCrystal.h>
LiquidCrystal lcd(39, 41, 43, 45, 47, 49); 
int buttonPin=46;
int buttonState; 
int lcdmillis=0;
int pumpe1=35;

void setup()
{
  pinMode(13, OUTPUT);
  pinMode(buttonPin, INPUT); 
  pinMode(pumpe1, OUTPUT);
        digitalWrite(pumpe1, HIGH);  

/*
  RTC.stop();
  RTC.set(DS1307_SEC,10);        //set the seconds
  RTC.set(DS1307_MIN,01);     //set the minutes
  RTC.set(DS1307_HR,15);       //set the hours
  RTC.set(DS1307_DOW,4);       //set the day of the week
  RTC.set(DS1307_DATE,25);       //set the date
  RTC.set(DS1307_MTH,6);        //set the month
  RTC.set(DS1307_YR,11);         //set the year
  RTC.start();*/
  lcd.begin(20, 4);

}

void loop()
{
if (millis() - lcdmillis > 1000) {
  lcd.clear();
lcd.setCursor(0,0);
  lcd.print(RTC.get(DS1307_HR,true)); //read the hour and also update all the values by pushing in true
  lcd.print(":");
  lcd.print(RTC.get(DS1307_MIN,false));//read minutes without update (false)
  lcd.print(":");
  lcd.print(RTC.get(DS1307_SEC,false));//read seconds
  lcd.print("  ");                 // some space for a more happy life
  lcd.print(RTC.get(DS1307_DATE,false));//read date
  lcd.print("/");
  lcd.print(RTC.get(DS1307_MTH,false));//read month
  lcd.print("/");
  lcd.print(RTC.get(DS1307_YR,false)); //read year 
  lcdmillis=millis();
}
buttonState = digitalRead(buttonPin);
if (buttonState == LOW) {     
     digitalWrite(pumpe1, LOW);  
  } 
  if (buttonState == HIGH){
    digitalWrite(pumpe1, HIGH); 
  }

}

Summarized:
An external power supply shows impact on my arduino controller and especially the 20x4 display.
So I need somehow to decouple it, making sure that voltage does not impact any other attached circuits on my board.
Or do you have any other idea what causes the crashes and what I should do?

A few wthings about me:
I am still an electronics beginner. Everything I built was with the help of this Forum (the German part). Unfortunately I did not find any solution in the German blog so thats why I try the international one.
I need to get this thing wroking stable, otherwise the entire work was for nothing. The controller will run 24/7 and needs to be stable.

Hope that you have any good ideas

Thy a lot
Thorsten

Keep logic signal cables as short as possible, decouple the supply a lot, decouple the devices that switch the LEDs even more (LEDs switch fast, fast switching causes havoc, fast switching many amps is bound to cause issues).
I'd suggest 470uF electrolytic and several 220nF ceramic across the LED supply right next to the switching device.

The motors may need decoupling to suppress inductive spikes.

Use twisted pair cables for all heavy current loads, don't run high current cables anywhere near logic wiring.

Make sure the grounds for all the supplies only connect at one point and that that point doesn't carry any heavy currents. This point is ideally at the Arduino.

Hi Mark,
thx for your feedback. Sounds like I need to totally re-solder my entire board :frowning:

But let me make sure I understood everything:

  1. How to decouple the supply? Is an optocoupler necessary and helpful?
  2. By "the devices that switch The LEDs" => do you mean the supply or the constant power source or in best case both?
  3. THe 470uF elco should be placed right after the power supply (from + to -)?
  4. Where shuold I place the ceramic condensators? At each constant current source?
  5. For the motors, I read that a diode and a capacitor could help? What you think? Would that also be helpful for the LEDs?

Thorsten

Do you have a circuit diagram of everything?

Hi Mark,
unfortunately not.
But attached a PDF with the three circuits that use external power supply (of course they are now added to one circuit):

  1. The dosing pumps (should use digital output) behind a ULN 2003 => I added a diode and ceramic condensator in the schematic but not on the circuit yet. This is just to check if this could help and if they are at the right places.)
  2. My LED control using a TLC 5940 controlling my constant current sources with 12bit PWM
  3. The motor shield for two 12v water pumps (this one was found online and I attached it twice to my circuit: http://schmelle2.de/wp/arduino/shields/jumping-ball )

I also have a second ULN but its quite the same as under 1), only that I use analog Outputs to control 0.5mm LEDs and 12vFans via PWM.

Hope that helps a little to understand my circuit?
I can give more information if needed or in worst case will draw the circuit this weekend, I dont care spending time on it as long as I get a stable controller finished!

Schematics.pdf (296 KB)

I've had a look - bit worried about the ground wiring - I recommend drawing the high-current parts of the circuit with thicker lines and ensuring that the Arduino stays well away from these parts (currently there's some ground wire between the ULN2003 and the 10k resistor that's carrying all the high currents and transients - this is going to put a lot of noise at one end of that resistor.

In the second diagram you seem to have the 700mA constant current ground current actually going through the arduino board's groundplane - that's going to be bad as that's a really fast switching current, and any inductance will turn that into large voltages (even a volt or two). The ground return must go straight to the TLC5940 with thick wire. run a separate ground wire from the TLC5940 to the Arduino in parallel with all the signal lines. Don't run these near the high current wires.

Hope that gives some scope for improvement/resolution.

Hi Mark,
thx for all the advices, let me double check if I understood everything:

  1. The High Current is coming from the 24v supply - thus you suggest to have an extra wire which connects from 24vSupply(-) to the Arduino GND without being connected to the GND wires of the ULN and 10k resistor?
    So all wires that have high current (12v, 24v) should never connect to any GND wire but instead always go straight to the Arduino. Of course they will be connected to eachother right there, wont they?

  2. Do you suggest to connect each driver (-) with PIN 22 of the TLC? And then have one wire connecting PIN22(TLC) straight (without connecting to any other GND wird) with ArduinoGND?
    One thing though: Each driver will be attached to my heatsinks. I dont want to have all GND wires going back parallel but rather connect all to one wire which then connects to Arduino GND (or in your case first to TLC GND, right?)

Please check this once again
Thx
Thorsten

tlc5940nt_pins.jpg

I dont want to have all GND wires going back parallel

That is the best way to do it. This is known as star wiring where all the grounds meet at one point. You can make the star on your heat sing if you want but make sure all the grounds go to that point.

Hi Mike,

see attached screen, that ok?

Thorsten

Sorry I am not sure what this diagram means.

Did you do all the measures in reply #2?
Did you read my decoupling page De-coupling

You defiantly need a diode across the motor and a small capacitor would help. If the motors only run in one direction then I would put a couple of inductors either side of the motor as well. Like shown in the attached drawing.

Motor.png

Hi Mike,

if you see my file "schematics.pdf" on #5, you can see on slide 1 that i have caps and diodes across the motor (which is called pump1-3).
Thx for the link, will have a deeper look at that once more. But looks very nice for what I have seen already.

Re my diagram: This shows the 10 heat sinks I will use. On each sink I will have 1 or 2 constant current driver. The lines you see are the GND wires that lead to what you call a star from where one wire should connect to the Arduino GND or (that is still a question I have) to the TLC GND first.

Thorsten

The TLC5940 is just being used as a voltage controller for your constant current drives. Therefore there will be no significant current in the ground leads for this part and I would connect it to ground close to the arduino, then have your ground wire from the heat sink star point to the arduino.
OK on the motor suppressor circuits but you could add one or two inductors like I showed to improve things.

How much current do these motors take? I am not sure that a single ULN2003 will cope. I know it is 500mA per channel but thermal considerations reduce this to about 640mA for the whole chip at any one time. See:-
http://www.thebox.myzen.co.uk/Tutorial/Power_Examples.html
Given your problem I would route the ground from the ULN2003 to the star point rather than the arduino.

Hi Mike,

Fortunately only low current devices use the ULN:
THe 3 pumps use 80mA each
ALso I will have Fans connected that also use under 100mA
And last but not least 6 normal LEDs which use 20mA each.
I will have one ULN for the three pumps and one ULN for the fans and the LEDs.
Guess that should work without additional cooling right?

I will think about the inductors. Is there any specific I should use? Might order those on ebay if I could use one of the same kind for all circuits.

I started creating a more detailled schematic, will later add the caps, diodes and inductors into it and also all the other circuits.
Have a first look

Thorsten

Is there any specific I should use?

Well best are wire wound with as high as an inductance as you can get, 1mH should be fine.

Guess that should work without additional cooling right?

Looks OK but how many fans do you have? The trick is to add everything up that could be on at one time and if it is less than about 65mA then you should be fine.

I started creating a more detailled schematic

It is conventional to have the power at the top and the ground along the bottom with inputs coming in from the left and outputs going to the right. Try and do this as much as you can as it will make it easier for others to read it.
Cheers

Hi,
well I dont use any real design software like eagle, I guess it would take me longer to learn than just do this with Powerpoing. I think my circuit is not that big so I hope not to confuse anyone but I will see if I can adjust the things you said.

Re the fans:
I have four alltogether. I run two in a row, so I can use my 24v supply. HOwever, I noticed that each fan has like 0,19A of current it needs.
That makes two strips, each 0,19A and 24v, so alltogether almost 0,4A. I need to mention that I control these by PWM and only, if my heatsinks get too hot, so they wont run for long periods.
What you think, will I need to cool the IC (ULN)?

Thx

will I need to cool the IC

Well you might. The best bet is to do some measurements and see how hot it is actually getting.