Arduino powersupply from 27V~

I got a motor for my garage door with a output for external equipment.

It is a 24V powersupply, but delivers 27V when the motor is idle (non regulated output)

To make it work with my arduino and my 12V relays I made my own little simple powersupply

(Relays are going to be added to the left, and control inputs from the arduino to the right)

First added a bridge to convert the AC into DC, then a L7805CV (measured output 4.89V) on for the power to the arduino and a L7812CV (measured output 11.85V) for the relays. And then using a ULN2803 between the arduino and the 12V relays.

From 24-27V down to 5V seems like a lot to me, and sounds like it will pull hard on the L7805CV, or what?

I don't have much experience with this, so some advises before I put it into use, would be great. :)

Oh and last, I plan to power the arduino through the VIN, would that be a vise thing to do?

Oh, just did a closer reading on the datasheet, they say 25uF in and 0.1uF out. But all I got avalible right now is some 100uF and some 10uF, would it be possible to use them? Or is it very important that they are the exact values as in the datasheet?

Okay, adding the 100uF to the input then, and going to have a look at some of the old stuff i got laying and see if i can harvest anything usefull from it ;) thank you for your help so far

There, found some 0.15uF so that is pretty close to the 0.10, hope it is close enough because I think I was through most of my electronics scrap.

So far so good, but what about the VIN? Would it be right to power the arduino through that, now when I got a regulated power supply for it? And what about the step from 27V to 5V?

So far so good, but what about the VIN? Would it be right to power the arduino through that, now when I got a regulated power supply for it? And what about the step from 27V to 5V?

Going from +27vdc through a 7805 type regulator is a large voltage drop and depending on how much +5vdc current you will be drawing on the Arduino board, the external 7805 might run very hot. If you are only powering the board then the current draw will be very low and it would work fine. However if you are using the Arduino +5vdc pin to power lots of LED's, etc then the current usage will be much higher.

To keep it simple, I would just try using your external +12vdc regulator's output and wire it to the Arduino's Vin pin. Again the current draw of the Arduino board and external components become the limiting factor as to how hot the +12vdc regulator will run at.

Be sure you wire backward connected diodes right across the relay terminals to keep transient spikes from propagating into your power circuits.

Lefty

Going from +27vdc through a 7805 type regulator is a large voltage drop and depending on how much +5vdc current you will be drawing on the Arduino board, the external 7805 might run very hot. If you are only powering the board then the current draw will be very low and it would work fine. However if you are using the Arduino +5vdc pin to power lots of LED's, etc then the current usage will be much higher.

It will only power the arduino and the wishield 2.0, nothing else. The 12V and 5V circuit should be seperated by the ULN2803.

WiShield 2.0 specs: - Sleep mode: 250[ch956]A - Transmit: 230mA - Receive: 85mA

To keep it simple, I would just try using your external +12vdc regulator's output and wire it to the Arduino's Vin pin. Again the current draw of the Arduino board and external components become the limiting factor as to how hot the +12vdc regulator will run at.

My idea was to use the 5V regulator for the arduino only, and the 12V for the relays to. It is going to only drive 2 relays first, but I might add more later, thats why I wanted to keep them seperated, and so if the 12V one fails because of the relays making it burn out or something, then would it only be the relays that got burnt.

I could also use a 12V regulator for the arduino, but the regulator on mine gets very warm when the wishield 2.0 is on.

Be sure you wire backward connected diodes right across the relay terminals to keep transient spikes from propagating into your power circuits.

Yes, going to add one 'across' the ULN2803.

Okay, but how important is it? Like, of curse it is important to make it right, but I searched on google on how others used the ULN2803, and every single one I found just uses one diode to take care of it. A few of them even show'd how it was done before (one on each coil) and how it was done with one single on the ULN2803.

Thought that when everyone did it like that, it must be the way it was done with it. But also easy for me to add one over each coil, just wonder why everyone does it the other way.

Thought that when everyone did it like that, it must be the way it was done with it. But also easy for me to add one over each coil, just wonder why everyone does it the other way.

One reason is that it is always better to 'shunt' the transients as close to the source causing them as possible. Shunting them after a long wire run or through a semiconductor IC terminal is just not as effective. ICs have them sometimes built in to protect the IC not necessarily the whole system. So to repeat, best to have them on the relay terminals.

Lefty

Wasn't it the leming who said "I'm jumping off this cliff because everyone in front is doing so"

Good engineering practice and/or common sense should never be substituted by "following the crowd"

jack

Good engineering practice and/or common sense should never be substituted by "following the crowd"

Except when it comes to voting in elections. The lemmings will always determine the outcome, might as well join them. ;)

Lefty

Wasn't it the leming who said "I'm jumping off this cliff because everyone in front is doing so"

Good engineering practice and/or common sense should never be substituted by "following the crowd"

jack

True, but without knowing anything about that thing, you can't use your common sense, because you simply don't have a clue about what is more right than the other.

So what would you do if didn't know what to do?

I did as most people are told to do, searched to find the solution on my problem, by looking at how others did it. And when over 10 different people on 10 different sites did it the same way, and even show'd how it was done before (no idea how it was done before without the ULN2803), and then how it was done with the ULN2803, I figured that must be the way. But apparently that was 'wrong' to search in an attempt to solve the problem too.


But back on the topic...

The 5V should be pulling around 300mA, and that is when the WiShield is on it's highest documented current plus a bit for the Arduino itself. (wasn't able to find any accurate measures, but found some saying it used about 70mA when running a program and not supplying anything on any of the outputs, and that is how mine will be most of the time too.)

and then how it was done with the ULN2803, I figured that must be the way. But apparently that was 'wrong' to search in an attempt to solve the problem too.

It's not 'wrong', it's just not necessarily the 'best' method. The single diode at the ULN2803 might very well be effective in many designs. However if say the wire runs from the ULN2803 is 20 feet away from the relays, you might still see transients couple into your power source that you wouldn't see if you use diodes across the relay coils. A lot depends on the induction value of the relays, that determines how large a transient is developed from the collapsing magnetic field when the relays are de-energized. Also it would depend on if any of the relays de-energize at the same time or not. There is no 'perfect' solution to things like transient suppression and ground loops, it's as much an art as a engineering task and past experience to tame such problems, if indeed you even have these problems.

I have used relays driven directly from Arduino output pins and used no diodes at all (couldn't as they are single coil latching relays, and therefore there is no 'backwards' voltage that would allow a diode installation), however these were very low current relays, around 12ma and the Arduino output pins are pretty rugged and I've had no problems to date wiring that way.

So keep in mind that user advice posted here is based on person experience and maybe not the best or only solutions to your task. Indeed I have even seen 'solutions and recommendations' posted here at times that was absolutely wrong (go figure, someone is wrong on the Internet ;) )

Lefty

Got it with one diode for each coil now, and even got one for the ULN2803 too, and hope it can just stay there too, so I don't have to move it again...

And I only got about 15mm for the one, and 20mm for the other, wire soldered on the bottom of the board... And they are Omron G2R-1-12V relays.

Without wishing to become embroiled in an argument about right and wrong circuit design, the 2803 has a potential weakness in that all 8 output suppression diodes are connected to a common pin. If this pin, or its track becomes defective (even slighyly high resistance) the effectiveness of the onboard suppression diodes will be compromised.

The older generation of us will remember using lamp test circuits on control panel alarm lights,.by means of a common test button feeding banks of diodes to each indicator lamp. If any single diode failed short circuit, this acted as a common feed such that any circuit going into alarm would bring up all indicator lamps. - not much help when the bovine is hitting the fan.

ie a single failure mode can jeapordise all your circuits, so good design practice will endeavour to engineer out such common mode failures wherever possible. For the price of a penny diode across each of the relay coils, your circuit integrity will be much improved.

jack

Almost finished the power supply.

One diode for each relay, and even one for the ULN2803 too (too lazy to remove it again).

The capacitors also helped on the voltage, the 12V is measuring 12.00V and the 5V is 5.01V, so this is so close to being perfect :smiley: thank you, all who shared information here.

Also tested the relay functions, and everything is working just like expected, and the relays driven by the 12V circuit and control (+ Arduino) by the 5V.

Probably look extremely simple for most here, but this is actually the most “advanced” circuit I have made so far.


Got everything ready for it now, just asking a last time before destroying anything…

Should I be able to just connect the minus to GND and the 5.01V to the 5V pin on the Arduino, and then power it all from that?

Got everything ready for it now, just asking a last time before destroying anything...

Should I be able to just connect the minus to GND and the 5.01V to the 5V pin on the Arduino, and then power it all from that?

Yep, sounds like it's time for the smoke test. ;)

Just kidding, you seem to have done a nice construction job and should have no problems.

Lefty

You’ll have to disconnect the 7805 from the 27 volt feed circuit and I’d even suggest that you remove the 7805 all together, otherwise you’ll have two 5 volt regulators (yours and the arduino) trying to feed a single circuit without blocking diode isolation. This could lead to instability.

Congrats on a neat build.

jack

You’ll have to disconnect the 7805 from the 27 volt feed circuit and I’d even suggest that you remove the 7805 all together, otherwise you’ll have two 5 volt regulators (yours and the arduino) trying to feed a single circuit without blocking diode isolation. This could lead to instability.

Congrats on a neat build.

jack

Feeding it by the 5V pin should bypass the regulator on the Arduino? Because it is on the output side of it, shouldn’t it?

Just finished the first of the code for it too

#include <WiServer.h>
#define WIRELESS_MODE_INFRA      1
#define WIRELESS_MODE_ADHOC      2

#include <WString.h>                // include the String library

boolean debug = true;

// Wireless configuration parameters ----------------------------------------
unsigned char local_ip[] = {192,168,1,10};      // IP address of WiShield
unsigned char gateway_ip[] = {192,168,1,1};      // router or gateway IP address
unsigned char subnet_mask[] = {255,255,255,0};      // subnet mask for the local network
const prog_char ssid[] PROGMEM = {"dd-wrt"};            // max 32 bytes

unsigned char security_type = 3;      // 0 - open; 1 - WEP; 2 - WPA; 3 - WPA2

// WPA/WPA2 passphrase
const prog_char security_passphrase[] PROGMEM = {"xxxxxxxxxxxxxxx"};      // max 64 characters

// WEP 128-bit keys
// sample HEX keys
prog_uchar wep_keys[] PROGMEM = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d,      // Key 0
                          0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      // Key 1
                          0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      // Key 2
                          0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00      // Key 3
                        };

// setup the wireless mode
// infrastructure - connect to AP
// adhoc - connect to another WiFi device
unsigned char wireless_mode = WIRELESS_MODE_INFRA;

unsigned char ssid_len;
unsigned char security_passphrase_len;
// End of wireless configuration parameters ----------------------------------------


int motorPin =  0;    // Pin the motor trigger is connected to

void doorMove()
{
  digitalWrite(motorPin, HIGH);
  delay(100);
  digitalWrite(motorPin, LOW);
}

// This is our page serving function that generates web pages
boolean sendMyPage(char* URL)
{
  String temp = "";
  temp += URL;
  
  for (int i=0; i < 60; i++)
  {
    temp.append(URL[i]);
  }
  
  if (debug) Serial.println(temp);
    
  if(temp.contains("?do="))
  {
    temp = "";
    for (int i=0; i < 60; i++)
    {
      temp.append(URL[i]);
    }
    
    String function = temp.substring(temp.indexOf("=")+1, temp.length()-2); 
    
    WiServer.print("Doing: "); WiServer.print(function);
    
    if (function.contains("move"))
    {
      doorMove();
      return true;
    }
  
    WiServer.print("Did: "); WiServer.print(function);
  }
  
  else if (strcmp(URL, "/") == 0)
  {
    // Use WiServer's print and println functions to write out the page content
    WiServer.print(analogRead(0));
    return true;
  }
  
  WiServer.print("No function");
  return true;
}

void setup()
{  
  pinMode(motorPin, OUTPUT);
  digitalWrite(motorPin, LOW);
  
  // Initialize WiServer and have it use the sendMyPage function to serve pages
  WiServer.init(sendMyPage);
}

void loop()
{
  // Run WiServer
  WiServer.server_task();
}

Instead of > if (function.contains(“move”))

I first tried > if (function == “move”)

but that is giving me > error: ambiguous overload for ‘operator==’ in ‘function == “move”’

isn’t it possible to somehow verify a string like that?

I'm doing something that may be somewhat similar (routerbot using an unmodified wireless router) and have found it very helpful for trouble shooting to open a serial port and have the result of each operation sent back to the serial monitor for review.

Executing the functions is not a problem, only the way to determine what function it is.

Another problem is now that the 5V output can’t even pull the arduino, and far from with the wishield on.

Voltage drops to 1.04V with the wishield on, and 2.42 with it off.

No idea why, the datasheet for the transistor said it would take a lot more (cant remember exactly what it was) than what I should need. What can be wrong? (or maybe i read the datasheet wrong?)


Update

Problem is both on the 5V and 12V… the 12V drops to 2.5V with the arduino on, and without and only pulling one relay, it is 10.25V.

And by just pulling one relay the transistor gets VERY warm after only two minutes.

Must have been reading wrong somewhere on how much they could take, what should I take instead of them then?