Solar switch enclosure

I’m going to write a longer post later on about how I went from there to here, but I recently finished my solar switch and decided to go ahead and post some shots.

Solar switch front showing LCD, LCD backlight switch, and shutoff override switch (red switch).

Solar switch back showing Xbee antenna, AC and DC current sensor inputs (using mini stereo phone jacks), and power chord).

Final solar switch circuit with an arduino-on-a-breadboard running the 200A DC relay on top, and equipped with a voltage divider, DC and AC current sensors, and Xbee ZB for wireless (complete with its own 3.6V voltage source and logic level shifting on IO).

And, here is a gallery of pics of the process, including earlier versions of the circuit and cutting holes into the case, as well as some wireless testing.

Simple 9V voltage regulator circuit

A very quick post here to document a very simple 9V voltage regulator. This is part of my solar switch project. For the final setup, I want to replace the arduino uno with something of a more appropriate size, such as wiring my own arduino-on-a-breadboard, or using an arduino pro mini. In either case, I have to supply my own power from my 12V solar battery source, and seeing as the solar batteries are actually over 13V when fully charged, I need to drop that down a bit to get into the 5 – 12V range accepted by the arduino pro mini.

The circuit laid out on the breadboard with a DC 12V power supply as input.

The circuit laid out on the breadboard with a DC 12V power supply as input.

I researched around and learned that I needed something called a voltage regulator, which is a component that looks much like a common MOSFET transister, but slightly larger. It has three pins which are quite simply voltage in, voltage out, and ground. This couldn’t be easier to understand. I’m using the LM7809 voltage regulator from Fairchild. It takes a maximum of 35 volts as input and outputs 9 volts.

For the most basic voltage regulator circuit, you only need two more components, both capacitors. One sits between voltage in and ground, and the other between voltage out and ground. The former is an electrolytic capacitor of 0.33uF, while the latter is a ceramic capacitor of .1uF. According to various sources, the values do not have to be spot on, and there seems to be an acceptable range, but I took the figures from the LM7809 datasheet to play it safe.

Here is the circuit diagram helpfully provided by the datasheet:

LM78XX voltage regulator circuit diagram

The point is just how simple this is. The next time you need to drop your voltage from a battery or DC plug, just get yourself these three parts and plug them in and save some money.

Sun Hayato “New Solderless Breadboards” models SAD-01 and SAD-11

Today I’m posting about something mundane but very important to electronics hobbyists: breadboards. The breadboard is one of the first things you buy when you are learning basic electronics or Arduino for instance.

If you try to do anything complex with one, though, you find out the limitations of the standard wiring and pin layout right away. For instance, not all components can be used on them as is, and when you place ICs, large DIP format components, or 0.1″ (2.54mm) pitch breakout boards on them, you quickly run out of space.

The other day, I was perusing the supplier web sites trying to decide which size breadboard to use as the semi-permanent base for my solar switch. Basically my choices were half or full size, or so I thought, until I noticed that the Japanese electronics supply maker Sun Hayato (actually pronounced sanhayato) had breadboard parts broken down into smaller sections that you could snap together to form alternative layouts. On top of that, I noticed they also had a series they call their “new” breadboards. It turns out that those were exactly what I was looking for to do arduino + sensors  + wireless projects. So this post is to talk about those boards in particular and to recommend them to you.

Sun Hayato's lineup of "new" breadboards

Sun Hayato’s new breadboards have three primary differences, but they are important ones for arduino users. The first is that they connect 6 pins in each row instead of the usual five in the main component layout area. This is a big deal because when you place an arduino pro mini or xbee or an LCD on your board, it takes up quite a bit of space by covering a few unused pin holes in either direction. So, the extra pin in each row gives you just that extra bit of room to wire your component. The next addition is that instead of two banks of connected rows with a single slot down the middle to seat DIP components on, bracketed by voltage and ground lines on either side, you get a whole 4 banks of connected rows with three DIP sized slots down the middle, and the power strips are at the *ends* rather than the *sides*. Finally, there is one more block of connected rows at the end on the other side of one of the power strips that is perpendicular to the other blocks. This extra block is therefore the perfect area to place IO components like connectors, especially if you plan on putting your breadboard into some kind of case as is, as I plan to do, instead of transferring the circuit to a PCB board first.

Closeup of Sun Hayato's model SAD-01 "new" breadboard(Warping in photo is due to my cheap smartphone camera)

Sun Hayato’s lineup of boards, including the usual layout as well as other snap on parts, is available at most Japanese domestic electronics shops both online and offline. However, I did not see much info about them in English, so here is a link to the export side of Japan’s number one online mall, Rakuten Ichiba, called Rakuten Global Market. Just search for the part name and you might be able to shave a few cents off the price that I’ve linked to. Also, this is a good site to search for stuff that cannot otherwise be sourced outside Japan.

Sun Hayato new solderless breadboard model SAD-01

Sun Hayato new solderless breadboard model SAD-11 (with added banana plug connectors for power)

These aren’t affiliate links by the way, so I don’t profit if you click on them and buy something.

Beaglebone via Adafruit Industries

Today my Beaglebone arrived from Adafruit industries. This is the tiny PC I’m going to be using as my 24/7 monitoring server for my sensor network.

Here you see the case (unassembled) that I ordered to go with it. As usual, everything was much smaller than I imagined, even though I’d seen photos of it held in a hand.

And here is the case assembled. This is the first time I’d ever assembled something made from laser cut parts, and needless to say, now I want a laser cutter….

The latest README from beagleboard.org suggested I simply plug in power and LAN and access the beaglebone via browser or SSH. Unfortunately, my network doesn’t support Avahi, so couldn’t just access “beaglebone.local” and I had to ping around for the IP address that was assigned by DHCP. Once I found it, I was able to display the default page served up by the beaglebone’s httpd in Chrome:

Of course, the first thing I did was log in via SSH and change root password.

A good review of recommended first steps can be found at the borderhack blog.

And here is the beaglebone hooked up to my LAN and looking pretty cool in its clear case on the shelf next to my router and UPS.

As mentioned above, this is going to be my monitoring server. Technically, any old PC would have been fine, and I have a stack of broken old intel gear from which I could have easily scraped together something relatively low power. So in other words, I don’t have any plans to use the beaglebone to drive any other gear directly, so all the cool I/O pins will unfortunately not be put to good use. However, the benefits to me of using this rather than an actual PC are that it is solid state and extremely low power, which to me lends itself well to 24/7 use. It won’t make any noise, and there are no moving parts, like hard drives, to break.

But I have to admit that now I have this up and running, some of its capabilities are quite intriguing, such as the ability to write software for it via browser and to even control IO via JavaScript (though I wonder about security there).

I will need to write some software eventually to graph and process the data I collect, unless I find a good package for that, so the browser interface will probably be a boon. At least it will be more “graphical” an interface than doing everything in a normal command line.

I may eventually use Ubuntu on this board rather than the included Angstrom Linux, simply because I’m more familiar with the former, but the cool thing about using SD for permanent storage is that I can very easily just swap out the whole “disk” at any time, and high capacity micro-SD cards are dirt cheap these days.

My first electronics project – a smart solar battery switch

So I needed a smart  solar battery switch, and I couldn’t find one available as a finished product, so I decided to try and make one. I consulted my friend Akiba over at Freak Labs, and he taught me the basic circuits I’d need to use to do what I wanted to do.

To explain what that is, I have a small 240 watt 12V solar system I use as an emergency power supply. It has a 1500W DC-AC inverter running off around 400Ah of deep cycle battery storage, which in turn is charged by 2 x 120W 12V solar panels. I also have a product called an “eco switch” which takes one grid power and one renewable power source (AC) as inputs and has one regular (Japanese) 100V AC outlet. Power from the outlet is taken from the renewable input if available, with the grid power input as fallback.

The one problem with the system is that my inverter is capable of pulling more amperes than the charge controller wants to give it. The charge controller sits, usually, in between the panels, batteries, and inverter, controlling all three. It prevents the batteries from being overcharged and overdrained. My controller, in an effort to save money, is a Chinese manufactured model rated up to 40A DC. However, my 1500W inverter can pull up to 125A (peak 166.6A). In fact, it won’t even operate when there is no load on it when plugged into my 40A controller. However, it works fine when connected directly to the battery bank. But the problem with that is that now there is no overdrain protection. So long story short, I needed a smart switch which would monitor battery voltage and cut the power to the inverter when it got low. And while I’m at it, I figured I might as well monitor current drawn by the inverter and log the data so, upload it to a server wirelessly, and then graph the results.

This gallery shows the steps from initial prototyping of the basic circuit up to the functional prototype using my 200A capable 12V relay.

I started by setting up a manually switched circuit in order to learn how the various components functioned. It took me quite a while, despite the availability of component data sheets, to figure out how to correctly wire the transistor and relay, which are the most important components in the switch part. In my experiment, I’ve got a regular toggle switch sitting in as the “smart” part, so I pretend that the batteries are low when the switch is off, and charged when I turn the switch on. That toggle switch then powers a transistor, which itself is basically like another switch which provides power, or doesn’t, to yet another switch, the relay. The reason for the transistor is that the toggle switch here is sitting in for an integrated circuit which will only provide a digital signal, which means 5 volts at low current. This is not enough power to operate the relay, which is the component that actually turns on or cuts off the connection from the batteries to the inverter. The transistor solves that problem. It has three pins, the “base”, “collector”, and “emitter”. The collector is just your positive voltage, the emitter is negative, and the base acts kind of like a push button. Push the button down (power it) and the transister will allow voltage to pass from in to out, or from collector to emitter. Don’t push the button, and no voltage will pass. The point is that the power going to the in, to the collector, can come directly from your power source. You can think of it as though there is a huge water pipe with an on off valve in the middle, and a guy standing there operating the valve.

The relay that the transistor controls is also just another switch, but it can handle much higher power going through it than the transistor could. That is why I can’t just put a transistor between my batteries and inverter. So basically, I am taking a very small power signal, the digital “on” signal from a chip (the one that is going to check my battery voltage and make a decision to power the inverter or not), and stepping up the strength of that on signal until it is strong enough to operate the big switch that sits on the main power line.

In the initial experiment, I’m using a very tiny little relay that can control a 12V line (up to 1A) from a 5V signal. In the finished prototype, I’ve replaced that with a massive (fist sized) relay made for automotive applications that can control up to a whopping 200A at 12V from a 12V signal.

In order to get that 12V control voltage to the relay, I had to upgrade my transistor. The transistor I already described above is called an “NPN” transistor, which you can Google if you want because I’m not going to go into why it is called NPN. Passing on a 12V signal is a bit out of it’s range, so I’ve replaced it with what’s called an N channel MOSFET, again, Google it. The function is pretty much the same as the NPN transistor, but the pin order is different and the pins have different names. Also, while both transistors require resistors nearby to function properly, the position and wiring is different.

Also, in my finished prototype, the manual toggle switch is replaced by an Arduino Uno. I’m not going to explain what that is, so instead I recommend you just watch this video:

Massimo Banzi explains arduino at TED

So the arduino is a device that let’s you itch the scratch and make that thing that you wish someone had invented. In this case, I have the arduino check the voltage on the batteries, and when it detects there is enough charge, it sends a digital “on” signal to that MOSFET. When the charge is inadequate, it sends an “off” signal (actually, it just doesn’t send any voltage). In order to check the voltage, I use what is called a “voltage divider”, which is a fancy name for two resistors wired in series. A neat trick with wiring two resisters in a row is that if you have a wire running out from between them, that wire will have a lower voltage than the voltage going into the first resister, according to a certain equation. In this case I have somewhere between 10V (batteries almost completely empty) and 13.9V (batteries full) coming into my voltage divider. The divider cuts the voltage to 1/3, which maxes out under 5 volts. The reason I do this is because the arduino analog input I use to take in the data only accepts up to 5V. The arduino, basically a little computer with very little memory and a tiny, tiny OS (kind of like the first computer I ever owned, actually), then takes that 5V and multiplies it by 3 (actually it is a bit more complicated but still easy) to learn the original voltage. When there is enough, it sends out the “on” signal from another pin.

Also in the final prototype is a basic LCD screen which I plug directly into some pins on the arduino to let it control the screen. Luckily, the arduino IDE includes libraries for operating an LCD. Here I have it showing the voltage that it has read from the batteries, which for now are just 8 x AA batteries that are very quickly being drained by the circuit. That is actually a good thing, because I can watch the voltage drop in real time to make sure the whole thing works. And it does. You’ll notice in each picture that there is a LED light on the breadboard that is lit up. This LED light and its resistor companion are on their own separate circuit with their own power source. The LED light represents my inverter. If the light is on, the inverter runs. If it is off, the inverter is disconnected.

Also of note is that I have a 10k ohm potentiometer (basically a volume knob) on the circuit at all stages. Initially, I used it to simulate drain to the batteries. Later, I had to hook it up to the LCD screen because the only circuit diagram I found for wiring an LCD to the arduino required it to control LCD contrast. For my finished circuit, I’d rather just fix the contrast at a certain level, so I’m assuming I can swap the potentiometer out for a regular resistor of the appropriate rating.

Still to do are to connect either a DC current meter or AC current meter, and the box the project up in a more permanent way so that I can put it to work on my solar system. Also, I need to add logging and, hopefully, wireless data uplink.

I’ve gone ahead and ordered a beaglebone to act as my data collection server. I wanted a PC that I could leave on 24/7 without using very much power at all, and this single board PC seems to be in the lead for low power consumption at the moment. Ultimately I’d like to wire my whole farm with wireless sensors, so in the future this beaglebone will have much more to do than monitor a single solar battery switch.

WordPress theme: Kippis 1.15