LAN of things - power system
Posted: Fri Jul 17, 2015 1:56 pm
The first unit on the Lan of things monitors the building I'm now living in, and controls the water system as well. It's been working really well - I had over provisioned a few things back when it was all manual, and I now have more water than I can use, know when to heat or cool before it gets to an extreme, and have a really nice database now spanning a good chunk of time.
For the next one - and this setup will wind up with at least 3 major nodes (the workshop being the other) - I did the "batterybox" or batbox pi and arduino. It's not finished yet - it has a web server with a default page, and I've not yet set up the database stuff, but it's already useful as is - one of the things it now does is control the Lister diesel backup generator water pump and cooling fan, and it monitors net amps to the batteries, some other temperatures, and I'll be adding a few more things to that as I get the hardware going for them. But it was time to put it in the box, on the local network and put it to use - tending the Lister was a fair pain with either always on or manual water pump and fan control it was really hard to keep the temperatures in bounds, and/or near the "sweet spot" where it makes less pollution and gets better "mileage". The engine can be quite efficient, and let me get a little further from "rolling from the punches" of nature - I have the AC running, a shower heated up, the car charged, and am making tea in the microwave right now, and I don't think I've used a quart of fuel (the car only needed a top off). Meanwhile, I can watch it all happen, though I haven't hooked up all the sensors yet - there will be more.
This whole project creates a large increase in my quality of life...off the grid one gets used to not taking showers every day, not having AC much of the time, and so on. Now I can have it when I want it (but still don't have bills other than taxes and a little fuel, not much). Seems like luxury to me without too much compromise. I still have to pay attention, but also still don't get surprised by a huge electric or water bill if I don't. Now that's luxury.
This setup is using a pi B+ model 1, as what the heck - it's loafing for what I want, and I had it from back when it was the hottest thing. Once you've used a mod-2...how you gonna keep 'em down on the farm when they've seen Pari? Now that I've done most of the software dev, I don't need the speed of a mod 2 for something that does things every 10 seconds or so...and I could reuse much of what I'd already done, so I wasn't waiting endlessly in edit/compile/test cycles anymore.
It IS cool that I can remote desktop from it, and actually code arduino and burn the one attached to it from my comfy cockpit here...and back it all up to a NAS on my network for "just in case".
I don't have time today to draw and scan all the schematics, and darnit, I wish my ISP wouldn't have a fit when I try to share a large file of code (you guys can email me, though) but I will get to it. There's still some refinement to be done - the ampere shunt signal, while accurate on the bench, is really noisy in real life due to PWM switching solar controllers, chargers not running at 60 hz, several inverters, etc...I need a low pass filter beyond what I want to ask from an arduino, for example.
I had designed that in, but then forgot to actually put it in the build...sigh. I will try to document the whole thing in this thread, but not all today - and one of the important things to document is "well, how does it work in real life, what fails" and so on.
EG, tell you my mistakes so you don't make them yourself.
Despite the arduino slaved to the pi being on USB rather than the multi-slave serial thing I did for the first one, I used the same code other than the serial port address on the pi. It works...it's error-tolerant. The unit number part of the protocol is superfluous, but I don't care.
But for now, some fun pics. Here's the computer stuff in place. The upper inverter is a really old, non-sine wave one I use to run my 5hp air compressor - only. It has had a failure or two (mouse pee?) and I never bothered putting the cover back on. Real life!
Now, I needed to switch some real power for controlling the radiator fan (6 amps) on the lister, and somehwat less for the water pump. So, I put the FETs and optoisolator in a bud box and mounted them right there - running skinny/cheap wire up to that as I'm still Scottish. I added some led indicators to the generator regulator box on the Lister that I can see out the window - I tend to backup my backups for things this important. Nothing beats an observant human.
Here's the schematic for half of the power switch. I used a dual opto-isolator, and a couple P-FETs from Adafruit (lazy, I normally get semis elsewhere but these are very good for this job and saved me having to look).
There is a 12v zener across the source/gate of the FET in case there is a spike on the lister 12v system (likely), a 1k resistor to protect things if the zener should happen to draw current, a 4.7k resistor to turn it off, and the opto with an input current limit resistor to turn things on. Interestingly in this case the optoisolator gives me voltage gain - a ~5v input becomes a ~12v output. The opto might not strictly have been required, but I have seen rather large voltages between "ground here" and "ground over there" when lightning hits - and they are cheap, and solved the problem of driving a high-side switch, which in turn saves me from having to rewire what was already on the Lister and keep the manual switch backups in place with no changes. As they say "An engineer is a guy who can do for a nickel what any damn fool can do for a dollar" - and in this case, it's likely to be more reliable as well. I forgot to show that there is also a catch diode preventing the FET drain from going below ground, but there is one there - a 6 amp/kV rated TV flyback diode I happened to have in stock in quantity (way overkill, but hey). The led indicator stuff is elsewhere, but if I need to draw a LED and resistor for you - this thread isn't for you.
There are two of these on a perfboard in the bud box (one opto isolator) that are simply hooked to different things (fan and pump) on output, and different arduino pins for input.
More in the next post.
For the next one - and this setup will wind up with at least 3 major nodes (the workshop being the other) - I did the "batterybox" or batbox pi and arduino. It's not finished yet - it has a web server with a default page, and I've not yet set up the database stuff, but it's already useful as is - one of the things it now does is control the Lister diesel backup generator water pump and cooling fan, and it monitors net amps to the batteries, some other temperatures, and I'll be adding a few more things to that as I get the hardware going for them. But it was time to put it in the box, on the local network and put it to use - tending the Lister was a fair pain with either always on or manual water pump and fan control it was really hard to keep the temperatures in bounds, and/or near the "sweet spot" where it makes less pollution and gets better "mileage". The engine can be quite efficient, and let me get a little further from "rolling from the punches" of nature - I have the AC running, a shower heated up, the car charged, and am making tea in the microwave right now, and I don't think I've used a quart of fuel (the car only needed a top off). Meanwhile, I can watch it all happen, though I haven't hooked up all the sensors yet - there will be more.
This whole project creates a large increase in my quality of life...off the grid one gets used to not taking showers every day, not having AC much of the time, and so on. Now I can have it when I want it (but still don't have bills other than taxes and a little fuel, not much). Seems like luxury to me without too much compromise. I still have to pay attention, but also still don't get surprised by a huge electric or water bill if I don't. Now that's luxury.
This setup is using a pi B+ model 1, as what the heck - it's loafing for what I want, and I had it from back when it was the hottest thing. Once you've used a mod-2...how you gonna keep 'em down on the farm when they've seen Pari? Now that I've done most of the software dev, I don't need the speed of a mod 2 for something that does things every 10 seconds or so...and I could reuse much of what I'd already done, so I wasn't waiting endlessly in edit/compile/test cycles anymore.
It IS cool that I can remote desktop from it, and actually code arduino and burn the one attached to it from my comfy cockpit here...and back it all up to a NAS on my network for "just in case".
I don't have time today to draw and scan all the schematics, and darnit, I wish my ISP wouldn't have a fit when I try to share a large file of code (you guys can email me, though) but I will get to it. There's still some refinement to be done - the ampere shunt signal, while accurate on the bench, is really noisy in real life due to PWM switching solar controllers, chargers not running at 60 hz, several inverters, etc...I need a low pass filter beyond what I want to ask from an arduino, for example.
I had designed that in, but then forgot to actually put it in the build...sigh. I will try to document the whole thing in this thread, but not all today - and one of the important things to document is "well, how does it work in real life, what fails" and so on.
EG, tell you my mistakes so you don't make them yourself.
Despite the arduino slaved to the pi being on USB rather than the multi-slave serial thing I did for the first one, I used the same code other than the serial port address on the pi. It works...it's error-tolerant. The unit number part of the protocol is superfluous, but I don't care.
But for now, some fun pics. Here's the computer stuff in place. The upper inverter is a really old, non-sine wave one I use to run my 5hp air compressor - only. It has had a failure or two (mouse pee?) and I never bothered putting the cover back on. Real life!
Now, I needed to switch some real power for controlling the radiator fan (6 amps) on the lister, and somehwat less for the water pump. So, I put the FETs and optoisolator in a bud box and mounted them right there - running skinny/cheap wire up to that as I'm still Scottish. I added some led indicators to the generator regulator box on the Lister that I can see out the window - I tend to backup my backups for things this important. Nothing beats an observant human.
Here's the schematic for half of the power switch. I used a dual opto-isolator, and a couple P-FETs from Adafruit (lazy, I normally get semis elsewhere but these are very good for this job and saved me having to look).
There is a 12v zener across the source/gate of the FET in case there is a spike on the lister 12v system (likely), a 1k resistor to protect things if the zener should happen to draw current, a 4.7k resistor to turn it off, and the opto with an input current limit resistor to turn things on. Interestingly in this case the optoisolator gives me voltage gain - a ~5v input becomes a ~12v output. The opto might not strictly have been required, but I have seen rather large voltages between "ground here" and "ground over there" when lightning hits - and they are cheap, and solved the problem of driving a high-side switch, which in turn saves me from having to rewire what was already on the Lister and keep the manual switch backups in place with no changes. As they say "An engineer is a guy who can do for a nickel what any damn fool can do for a dollar" - and in this case, it's likely to be more reliable as well. I forgot to show that there is also a catch diode preventing the FET drain from going below ground, but there is one there - a 6 amp/kV rated TV flyback diode I happened to have in stock in quantity (way overkill, but hey). The led indicator stuff is elsewhere, but if I need to draw a LED and resistor for you - this thread isn't for you.
There are two of these on a perfboard in the bud box (one opto isolator) that are simply hooked to different things (fan and pump) on output, and different arduino pins for input.
More in the next post.