26 Responses to Monitoring and controlling devices, with an embedded microcontroller and web server.

  1. mobile-bob says:

    i noticed the arduino at radio shack maybe about a year ago
    but decided to wait it out and see what all the fuss was about.

    right now i am about armpit deep into the bs2 stamp, i think i have 12 micro’s and all sorts of other stuff that works with them.

    for what i need done, these things are a huge step from “rocks and sticks” or relay logic that i was working with.

    it so nice to build something, get it close and then be able to dial it in via program code!

    someday i think i will give the arduino a try, but i am not at all ready to start learning all the more advanced programming language, even if it would afford me more options.

    otherwise i will at least follow along with great interest! really cool seeing what is possible for very little money and a bit of time.
    especially given having to work out all sorts of rube goldberg methods i used to use in order to get some automation using rather crude mechanical means.

    bob g

  2. George B. says:

    I Think what Steve offers is by far the biggest bang for the dollar, part of the reason is you don’t easily paint yourself in the corner, as there’s plenty of power and more support every day. Being able to down load code to support read and write routines to an SD card and more means you can get stuff done with less of a learning curve and not get frustrated and quit. A little understanding of micros changes how you think forever. so I think..

    I mentioned Jack belk in my intro, for those who haven’t read some of his doings, google searches like ‘utterpower jack belk’ should get you started.. here’s one you might enjoy.. https://www.utterpower.com/magic-hot-springs-idaho-a-lesson-about-the-value-of-hands-on-knowledge-in-alternative-energy/

  3. George B. says:

    Question, are you suggesting anything between the I/0 port and the SSR, or are you just using the internals to the processor to condition the port for driving the SSR?

  4. KK4HFJ says:

    The SSR has an optoisolated trigger, already conditioned for direct connection to the arduino port. Nothing in between is necessary.

  5. Quinn says:

    George, thanks for the bit on the Arduino. I’ve had one for about a year, and have just played around with turning on and flashing LEDs, turning on and off transistors, etc., but the technology is eminently useful. And with the enormous user community out there who are only too willing to share what they have done, it’s an easy technology to get up to speed. I’ll be sitting in the back of the classroom watching to see what the smart kids devise.

    • George B. says:

      Quinn, I’ve had this idea of adding the missing piece between the generator and the loads for a long time.. I could write 50 pages about how the logic flows, but being that Steve is an ET, DIYer, and interested in AE, he’s a great point man to elect as our leader in this effort! He’s on board with this hardware and I thnk it is the right hardware for us.. The key is knowing how different loads can be. Let’s use the standard fridge for example. If we kill it half way through a run, and attempt to start it again, we will see that the cheaper fridge will look like a crow bar has been dropped across our small generator or inverter 🙁 With this understood, we have the need to allow the fridge a full period of rest BEFORE we ever attempt to run it again.. This allows the pressure to bleed off, and we start the fridge quickly. Some (many) can’t start the compressor at all, and the locked rotor blows a breaker that auto resets in the hopes the pressure will bleed off before it resets again.. None of this is a problem in the average home, on the average grid. It’s when we take these loads to our samll Island that we discover how ugly they can be.

      Amongst the 50 pages I’d write is the software we can all evolve, and our DIY minds take it to the next step! We write code that learns, we know just how many amps it draws, we know what the gen set is carrying, and we know that what was atttached to SSR 4 drew 10 amps for .3 seconds, and then a steady 3 amps last time.. BUT first we need the basics, and we need canned examples to get folks started and interested in what we do.. The goal is to manage a small efficient generator, and schedule tasks that will keep it well loaded and produce a very impressive fuel to KWH figure. So I think but it’s all just another DIYer thought. Inventory the work, and do think about all those installs with dump loads! With this appliance we can schedule work done that would otherwise get dumped or just plain unused.

      Among those 50 pages I’d talk about a battery charger with half a dozen outputs. your codes knows each battery and floats it, it also writes a report at the end of the day “all seems well” think of all those batteries that go dead each year. This is a product not on the shelves, it’s one of a thousand you will think about once you get the basics..

      And at the end of the dump loads, when there’s nothing else to do? your appliance will do that for you if only you tell it.

      But there’s those folks who will ring their hands.. oh goodness, what happens when it all fails? Well, then you just default to manual, as you had before.. and of course, you make going back to manual part of your plan..

  6. Nate says:

    good link for the SSR’s. cheapest i’ve seen was $10 i think

  7. Bill knighton says:

    Something to look out for on solid state relays that I did not consider when shopping was leakage current. I got a nice usa made opto-22 120a25 25 amp ssr. The controller I was using was either an arduino or the bare avr mcu the ardiouno UNOs use. The output of the micro controller had no problems driving the ssr but my test load, a cfl bulb didn’t quite turn off. It would dimly flicker even in the off state. Reading the data sheet more carefully it turned out the that ssr leaks about 0.007 amps in the off state. That’s almost 1 watt wasted. I will shop more carefully next time. If I had a bunch of these going that would amount to a huge off grid waste. Also, outback inverters that have a search power mode that look for loads present to see if it’s time to turn on the inverter could end up on all of the time. It is a hard thing to get the search trigger just right for all of your needs. I would like to see how arduinos could help with this. Maybe stripping loads with the goal to let the inverter idle unless it really needs to come on. One obvious thing would be to kill the frost free heater in a refrigerator unless it’s day time and there’s good power being made.

    • George B. says:

      Bill, your experience is valuable, I was thinking the SSR might need a sink when on ‘On’ for more than a bit.. as we waste there unless we close a relay across it once on (an option for a latch if we are worried about parasitic losses.. and that could be a very small relay to stop it from attempting to heat the room, but I didn’t even imagine there would be leakage like that when open. Point well taken.. buy one SSR and play with it.

      Some times you find a friend that does commerical tear outs. those expensive atching relays they use in commercial lighting are gems to put in the junk box.. you can pulse up or down with a 24 volt pulse might be a better option for off grid mizers.

  8. Bill knighton says:

    How far could you push a mechanical relay in the setting you were writing about.
    2x or more? Is most of a relay’s life taken when sparking contact is made under load ?

    • George B. says:

      wonder if I understood your question bill..

      Mechanical relays have plenty of data, many will switch a lot of current many thousands of times. Some mechanical relays suffer more damage when you open the replay,closing it is no big deal.. many are equipped with magnetic blow out coils, and others used compressed air to literally blow out the arc.. It you’ve thought of it, they’ve doen it..

      It’s Interesting to take apart a Mr. coffee. Look at that tiny relay that switches how much current for how many years, and lookie there, a micro, and you can study from the I/O pin to the relay and see how they implemented it..

      As for the idea of using a mechanical relay to ‘cover’ the voltage drop across the SSR, you’d be looking at a very small relay to cover.. you need the logic to assure it’s opened before the SSR is dropped, for most of what we do, we might ask why? The Mr. coffee relay would do a lot of what we do 🙂 Especially off grid where we use more efficient appliances..

      This cheap part should allow us to do our thing with cheap mechanical relays with less worry.. see the rest of the family..

  9. Bill knighton says:

    I thought you were suggesting the use of a ssr to turn loads on and off and a mechanical relay to sustain the already switched loads. I was wondering if a mechanical relay, relieved of switching loads, could be far over loaded past its ratings.

    • George B. says:

      Regardless as to whether it could, sounds like an expensive approach. I was only attempting to figure a possible way to save the money for a heat sink 🙂

      • Bill knighton says:

        A regular hardware store light switch with a hobby servo would make an cheap relay. I wonder what power a servo uses when not in motion. Arduino has a pwm servo library as standard.

  10. mobile-bob says:

    this is what i use, and yes i also have a pile of the “opto22” SSR’s

    i went to ebay a number of years ago and found a source for a relay board, for 15 bucks i could get a board with 8 relay channels, all the parts (driver chip, led’s, relays, pullup resistors etc.) takes about 15 minute to assemble. or you can buy it assembled for 25 bucks.

    this one is very similar to the ones i ordered


    it uses 5 volt logic to the driver chip, which controls the 12volt coils of the little cube relays, which are dpst units. iirc they an switch something like 7amps at 240vac and do so for something like a half million cycles.

    i use the boards to interface the bs2 to my loads, basically between the micro and the power relays/contactors. doing so i can control a lightbulb all the way up to main switch gear taking the house off grid and onto generator power, or control my heatpump or any number of things.

    now i know that all you guys are much better at all this than i will likely ever be, but here is the rest of the system

    my build philosophy is different, in that rather than spend countless hours learning programming code, which i never had in school, i choose to spend a few more bucks up front in hardware to enable me to reduce my code requirements.

    the bs2 uses very simple and quite intuitive coding (i guess you would call it that) but the processors are a bit more expensive.

    having gotten into ibm’s microchannel architecture back in their heyday, it was something that stuck in my head how they used multiple processors, each to do specific tasks.

    so i adopted that philosophy or architecture, as best as i could for what was needed to be done.

    i use a main processor that does nothing but scan the loads, scan the available power sources, and it determines how each load is managed and where the power is going to come from. it is the master.

    i use separate micro’s, one to do the trigen autostart and management, another to manage thermal issues, pumps, fans, etc. and still others slated to do a variety of other control tasks. they are my slave’s.

    because the overall job is broken down to specific levels the bs2 is more than adequate to do the specific jobs at hand, and have all of them working more or less independent of the others, only answerable to the master.

    because i don’t want to get into one wire communication, i chose to setup a 5 wire buss, where each of the slaves can take commands from the master, and send back answers as needed to the master.

    it all works using 5 volt logic, is not at all hardware lean, but it is about as bullet proof as i know how to do it.

    i have no interface with the web, or a computer other than the program port to the micro which will display the commands running. that seems to be more than adequate to get an enormous amount of stuff done.

    i am using little current transformers to monitor the load lines to each major circuit, this way should the refrigerator start it will continue to have power until it shuts down. this assures there is no early shutdown and a restart against high head pressure. the same is true of the furnace, the blower will be allowed to continue to run unit such time the furnace shuts off the motor via the temp switch. this keeps the firebox from overheating should the blower shutoff before the temperature has fallen to the proper design level. what we don’t want is an interrupt mid cycle, this would surely lead to problems with overheated components in the furnace.

    as we all know there are loads we can interrupt, loads we can schedule, loads we can’t schedule and loads that once are started should not be interrupted except in an emergency.

    this arduino thing is quite fascinating, however for me the bs2 stamp is more than adequate. i can see that the other less costly alternatives would allow for commercialization much more easily that with multiple bs2 stamps.

    i just don’t see the alternatives being as easily mastered by me, perhaps if i could spend a couple hours with someone and learn the basics? maybe that would help.

    my friend George is to blame for this! he was the one that got me started with the bs2 stamp and it was love at first sight! i find working with it to be very intuitive and fits me like my favorite baseball cap. this might have been different had i had some experience with programming other stuff, even very basic stuff.

    as for George talking about writing 50 pages on this topic! i am in awe! for me to fully explain how this system works i am not sure i could explain it in 500 pages! that is not to say that the system is more complex (because it isn’t) but rather my ability to communicate at a level you puter guys understand is way over my head… if i could explain it all in ladder logic or relay logic maybe i could get it done in 250 pages? 🙂 (who am i kidding? nah!)

    well back to my corner,

    bob g
    ps. having reread what i wrote, the system as described was built and tested while living in a rental house in tacoma, between 2007 and 2010. it is now all in parts and will be slowly integrated and modified to our home here in kansas. it will take a while before i can get back to it, so meanwhile i will be watching the development of the arduino with much interest. i may be slow, but if there is a better way of getting done what i need done, i am all over that.

  11. Bill knighton says:

    This might be interesting to utterpower readers. It’s a thermo electric module capable of 15 watts. 15 volts 1 amp with the hot side at 260c. I’ve been waiting for a teg that produced usable power like this for more than 10 years. It is available now with a PayPal button. It does not seem to be vaporware. For 10 or more there is a significant price drop down to $60. My wish is that with a high tech oil heater or lpg heater that has mcus, combustion blowers and heat exchanger blowers all requiring power all night, 4 or 5 of these could convert enough of the heat to keep a charge on the batteries. It might require some smart adduino thermo management. Playing with a peltier device years ago I got it a little hot and melted the solder at the thermoelectric junctions. This one runs max at 260c but is rated to 325c. It would be easy to fry if pushed to 15 watts. But maybe there is a passive way to regulate the heat.


  12. Bill knighton says:

    One is ordered.
    It occurred to me there is another relay decice that hooks well to arduinos.
    I wish it were about $10 and not $26. But it would be a big time saver. I like the little mounting holes especially.

    • George B. says:

      Bill, a very handy item for quick prototype work.. I didn’t catch if this was compatible with CFs or similiar loads? When we think of wiring a big shop the old way.. running the wire all the way over to the wall plate. It’s expensive! We can use a piece of far less expensive bell wire to control a relay like this.. so it can make sense in long runs.. A friend across the street.. a carpenter.. I attempted to get him to consider using a few commercial grade latching relays to save half a mile of 14 gauge. He thought I was attempting to sell him some cutting edge plan that might cause him trouble, and no one but me would know how to fix it 🙂 Later he has a job in a commercial building where he actually saw the control wires in the false ceiling.. a miles of bell wire, and a few relays savign a ton of expensive copper… and wire losses! He admits.. had I listened I’d be money ahead. don’t forget those latchers, sure you need a power supply for the 24 volts to punch them up or down, but then, we are free of holding current, SSR sinks, votage drops across them and so much more.. I bet if we look, there’s also and off the shelf HVAC part with 3-5 volt <=3ma current inputs and 24V relay control out. What's on the shelves of the HVAC store si pretty amazing.. but we need stay focused on typical and easy to find solutions me thinks. You off gridders have a different set of concerns.. parasitic loads can impact your well designed solar system in a hurry.. that's why I like latching relays.

  13. George,

    There is some additional information that needs to be addressed with the Arduino and SSRs. When you use the Arduino with a shield, you do loose several of the digital pins to the ethernet interface. I am using the UNO and digital pins 0 and 1 are receive and transmit while pins 9 through 12 i believe are the SPI interface for the ethernet shield, which reduce the number of available pins. But of course, there are varieties of the Arduino that have more digital and analog pins than others – like the chipkit.

    The ssr’s are also designed for resistive loads instead of inductive loads, something I finally figured out when I couldn’t get a small fan to turn on with the ssr and I managed to burn out. Reading the specification of the SSR I saw that it operates as a zero cross circuit. I had to go here: http://www.wisegeek.com/what-is-a-zero-cross-circuit.htm to find out what ‘zero cross circuit’ meant.

    Now I’m a little smarter.

    • KK4HFJ says:

      Arduino communicates with both the W5100 and SD card using the SPI bus (through the ICSP header). This is on digital pins 11, 12, and 13 on the Duemilanove and pins 50, 51, and 52 on the Mega. On both boards, pin 10 is used to select the W5100 and pin 4 for the SD card. These pins cannot be used for general i/o. On the Mega, the hardware SS pin, 53, is not used to select either the W5100 or the SD card, but it must be kept as an output or the SPI interface won’t work.

      An SSR used with an inductive load can accidentally fire due to a high load voltage rise rate (dv/dt), even though the load voltage is below the allowable level (inductive load firing). Add a snubber circuit designed to reduce dv/dt.

  14. Sam Sabey says:

    Hi all,

    Just stumbled upon this looking at a lister gen set for my house, and it occurred to me I should check my actual data recorded over some time.

    A little background, I own and run smartenergygroups.com and have been working with Arduino for energy measurement for some time. I’ve got a bunch of open source energy stuff available and also an awesome web service to visualise the info.

    Last night it was a cinch to work out all I need is a 6/1 and a 5kW head to have plenty of headroom. The overflow could then be demand managed 😉

    If you’d like to have a look, check it out here

    Thanks for this ace website too!

    Sam, @samotage

Leave a Reply