Hello,
I have been working on this project for quite some time. It uses an Arduino UNO, a humidity sensor, a CO2 sensor and a 4 channel relay, all powered externally by a 12v 800ma source.
I finally have got it to work perfectly, but only while the Arduino is connected to my MacBook.
while only connected to the 12v external source the board only for some period of time before the it malfunctions (for some unknown reason) and reacts by turning on all relays, pulsing power before turning off and repeating that process before remaining off. It seems like the board is trying to reset itself after some type of failure. Sometimes the board turns on all relays and gets "stuck" as cannot communicate with the board via usb unless I unplug all power and reinsert usb and restart the sketch. So basically all relays remain off or all remain on indefinitely.
I have noticed a similar anomaly (while connected to USB this time) when the CO2 sensor fails to connect at start up, the board fires all relays in the on position indefinitely. I do not believe there is anything in the code that would tell the board to do anything if the CO2 sensor fails to initialize, except print that it has failed to do so, causing all relays to remain "ON" indefinitely.
Considering I would like to take my MacBook to school with me, how could I go about programming Arduino to overcome this problem?
The sketch uses if statements connected to environmental parameters and "blink with out delay" to achieve its tasks.
Why the Arduino fails to run properly while only connected to the external power source is still something I am trying to figure out and is the real problem here. Why would the sketch work flawlessly while connected to MacBook via usb and the external power, but not the external power alone?
code in question is below: (located in void setup)
if (mySensor.begin()) {
Serial.println("Wait 10 seconds for sensor initialization...");
delay(10000);
} else {
Serial.println("ERROR: Failed to connect to the sensor.");
while(1);
}
Hi,
Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?
How are you powering the 5V peripherals?
If you are using the 5V pin of the UNO, then when you have the PC plugged in, it is supplying the current for the 5V devices.
When you change to a 12V input, you are using the UNO internal linear 5V regulator, this device is limited in how much current it can regulate.
It sounds like it goes into thermal shutdown because of the current it is supplying and the 12V to 5V differential across the regulator.
-
A solution is to use a 5V supply connected to the 5V pin of the UNO rather than 12V to the DC socket.
-
Reducing the socket voltage from 12V to 9V may help, but it may just prolong the agony.
-
12V to the DC socket and a separate DC-DC converter 12V to 5V, would be better, the converter supplying 5V to the peripherals.
Tom... 
Post a link to the relay board you are using.
You may need a separate power supply for the relay coils -- the Arduino 5V regulator cannot deliver much current.
Hello,
Thank you for your input this project is very important to me and I appreciate your time.
I am currently looking for ways to draw the schematic using CAD, however in the mean time... I can explain it verbatim...
EVERYTHING is powered by the 5v on board regulator except the humidity sensor (which uses <5ma and powered by 3.3v)
Current draw of the infrared co2 sensor is 85ma at 5v and the three relays are powered by the same on board regulator, each using 50-60 ma at 5V. At times when everything is called upon at once, the MAX current draw is (60ma x 3) + (85ma) = 265 ma required from the onboard 5v regulator.
I have also read that the 5v onboard regulator is limited to the amount of current, this could very well be the problem. I do have a 5v 2000ma power supply on hand. I will try connecting the 5v to this source.
I left the circuit on overnight while both connected to the 12v source and my MacBook via usb. There were no problems. However before hand, I left the circuit on while powered by ONLY the 12v and it malfunctioned after 30 minutes.
link to 4-channel relay:
You are asking the regulator for way too much current from a 12V supply, so as reply#1 suggested, it is overheating and shutting down. The problem is that the regulator must dissipate the heat generated by dropping 7V at the total current draw (around 2 Watts).
Power the CO2 detector and relays from a separate 5V source, and connect the grounds. That source could be a different, but more capable step down regulator powered by the same 12V supply.
Mr. TomGeorge, Mr. jremington, Thank you very much for your input, You have helped me solve a very important issue in a very short amount of time. I appreciate you shearling your knowledge.
Get a 12V-5V buck converter, and use that to power everything (don't connect the peripherals to the Uno's 5V pins but directly to the converter). Connect it to the Arduino's Vcc pin, not to the RAW pin, as that way you bypass the on-board regulator.
Okay, thank you very much for you input, I just want to clarify a few things so I do not make a huge mistake somewhere.
-
Get the 12v-5v buck converter and solder the wires from the 12v 800ma power supply to Vin and Ground-out on the converter? Would it be better to use a breadboard barrel connector so I'm not cutting up wires and potentially mixing the positive and negative side wires from the external 12v power source?
-
Use Vout (5v) from the converter to power everything, including the Arduino. Is Arduino UNO's Vin pin the same as VCC?
-
When grounding everything, can I utilize the ground pin on the Arduino? Since technically, the UNO will only have the 5v connected to the Vin pin and no "external ground" from anywhere else.
The 12v-5v converter I'm looking at is something like this.
Thank you all. You have been very helpful.
profk007:
- Get the 12v-5v buck converter and solder the wires from the 12v 800ma power supply to Vin and Ground-out on the converter? Would it be better to use a breadboard barrel connector so I'm not cutting up wires and potentially mixing the positive and negative side wires from the external 12v power source?
Whatever you like. Normally the wires are colour coded (at least they were in all the adaptors and 12V things I've cut up so far). Red for +, black for -. Sometimes there's some other marking on the wire showing which one is +. And of course you can just use your multimeter to confirm this.
- Use Vout (5v) from the converter to power everything, including the Arduino. Is Arduino UNO's Vin pin the same as VCC?
Markings vary between boards (and clones). Vin is usually the 6.5-12V; sometimes called RAW. If you have a pin marked 5V use that. That's for sure a 5V input.
- When grounding everything, can I utilize the ground pin on the Arduino? Since technically, the UNO will only have the 5v connected to the Vin pin and no "external ground" from anywhere else.
Ground = 0V reference (it's not necessarily connected to earth), in this case linked to the negative output of your buck converter (which in turn is probably directly connected to the negative pole of your 12V adapter).
600 mA output is very little - better get a 2A converter. Those are dirt cheap, too.
Very cool. Thank you gentleman. You just helped save the world.
Hello again! I have purchased the 5v buck converter and used the onboard potentiometer to bring the 12v 800ma power supply down to 5.3v...
I connected everything, (after burning through an Arduino and 3 of the 5 buck converters) but the Arduino fails to boot, along with everything else connected to the new 5.4 volt power supply...
The fried Arduino powers up (onboard LEDs) when connected to the 5.3v source and ground coming from the buck converter, but nothing else.
What is going on here? Should I raise the voltage slightly?
(5.4v confirmed with a multimeter.)
link to buck converter:
Time for that delayed block/schematic diagram.
It doesn’t have to be fancy (not a Fritzy), but it will also help you in 6-months, (just like all the documentation and comments you’ve written!)
Man, I was really trying to avoid that one!
Is there a software you could recommend? Ill do it by hand if I have to....
OH! success! I don't know what I did... moves some wires around... but its working now! Wires were connected via top two arrays of pins.
I moved the source and ground wires closer to the output of the buck converter, instead of having them way on the other end.
Id still like a recommendation on some CAD for the Arduino schematics, if you have the time.
Set the regulator for 5.0V, not higher.
I use the free LTSpice for schematics and circuit simulation. Works great.
The longitudinal ‘power’ rails on the breadboard are split in the middle (two halves).
Hand drawn circuits - like the old days, or almost any tool.
If this is a rare event, something like Visio or other office tool, moving up to KiCad or Eagle and beyond if you’re going to make a habit of it!
Hi,
ExpressPCB.
https://www.expresspcb.com/free-cad-software/
Free, uncluttered, no advertisements or limits.
Tom.... 
But I would do a picture of a hand drawn circuit in jpg, png if you are new, then you don't have to look up components, they are all in your mind and hand.
Kicad works great for schematics and even PCB design.
Fir the breadboards, some have the power rails split, others not. Can be confusing indeed.