One of the tenets of the whole BEAM robotics thing was that folks should be making their creations out of easily accessible electronic parts of the sort you could scavenge out of dead electronics or find in Radio Shack. In the time since then, Radio Shack disappeared and it’s much harder to scavenge useful parts out of electronics.
What I really want is solar powered bits to make fun little solar-powered art bits out of and I’m at least relatively comfortable with designing my own PC boards. One big chunk of this is a nocturnal solar engine. Now, I’ve already been playing with the SIMD1v3, but I figured I’d do some actual monkeying around with alternative topologies.
Either way, a nocturnal solar engine needs to have some sort of solar power source, some sort of power storage, a switch to turn on at night, and something it does when the lights go dim.
I’ve made a few vague attempts between when I got a SIMD1v3 working and now, but the MD3 v3 is the first that’s worth talking about.
The solar power section
A reasonable solar panel from DigiKey
A lot of the solar circuits were assuming that folks were picking up a now-discontinued Panasonic cell that was reasonably priced and also a good performer. And some of that was translating the actually vague figures into something that I could feed into the DigiKey parts engine.
I found that a IXYS SM101K09L was about the right for this sort of circuitry. The VOC ends up being about 6.22V, which means that you should get up to 5V with a reasonable amount of light (Vmpp is rated at 5.02V) and being about 200 mW gives you enough power to charge a capacitor in a reasonable amount of time.
MAX40200 as a Solar reverse flow blocking diode
Solar panels are supposed to have some sort of method to block reverse flow. I need to measure this at some point to see exactly how catastrophically bad this really is for my application.
Either way, adding the diode drops the voltage. This is a bit of a problem for a simple capacitor-based solar circuit because every volt the diode drops is a little less power the fully-charged capacitor is able to store.
Traditionally, BEAM electronics used a germanium diode because it has a lower forward voltage drop. And you used to be able to wander into Radio Shack and get one. But germanium diodes are hard to find. The second-best option is a Schottky diode, but that uses up a little more power.
The SIMD1v3 uses the “diode” in a MOSFET for this purpose.
On the other hand, there’s this cute little IC you can pick up called an “Ideal Diode” that creates something that looks like a perfect near-zero-voltage-drop diode by using a MOSFET and some accessory circuitry. This a slightly more discrete version of the trick the SIMD1 nocturnal engines used with having the solar power pass through a transistor.
There’s a few of them on the market, but the MAX40200 is a reasonably easy to solder SOT23-5 package, so I got one and soldered it to an adapter board.
Zener diode clamp
Now, I’m using a solar panel with a VOC above 5.5V, which is in theory enough to fry the works now that we’ve got a diode with a low voltage drop.
Now, actually reaching the VOC is hard, because the VPmpp is right around 5.0V, so the voltage drops as soon as you start using power from the panel. If I want to test this case, it’s actually easiest to take one of my flashlights and shine a light on the panel.
So, we’re talking about a panel that can reach a voltage under certain circumstances but probably won’t, especially if you are using it indoors. Ergo, it’s not worth spending a lot of effort here. A standard linear voltage regulator here, for example, would end up wasting a majority of the engine. And if you want to use a switching regulator, you need to get a very specific one. I found a 5.6v Zener diode works just fine to chop off any overvoltage without blowing up.
Obviously, if you were talking about a more powerful solar cell, you’d need to increase the complexity here.
It’s not recommended to blindly put a bunch of supercapacitors in series to get higher voltages, although a lot of folks have totally gotten away with it.
I’ve mostly been using AVX through-hole supercapacitors. For this one, the SCMS22H255PRBB0, which is a 2.5F 6V capacitor. They are essentially two or three supercapacitors that have been put in series at the factory in a package that’s easy to deal with in breadboard form.
The on-off switch
(Slight warning: The pin numbers for U2 are for the SOT23-5 part, not the DIP-8 part)
The design goal here is that it should switch crisply and at a defined point. If the light slowly comes on as the lights go down, you are going to waste a lot of energy. And if it slowly starts to turn on, you end up wasting power.
Also, it works a lot better to use the power from the solar cell as a switching element instead of requiring a separate brightness sensor.
All of the existing nocturnal solar engines use a transistor, generally two of them (although sometimes the second transistor is “silent” because it’s the enable line for a 74HCxx part) to switch. This means that you are increasing the gain of the switch, which serves to achieve the goal of switching crisply.
I spent some time playing with transistors before I asked myself “Wait, isn’t there an IC called a comparator that is designed for this exact purpose?”
As it turns out, there are nanopower comparators, so called because they use nano-amps worth of power. Pretty much, a comparator is going to swing towards Vcc when the voltage of the V+ input is higher than the V- input and swing towards Vdd when it isn’t and that’s exactly the sort of behavior we want.
I started out with a relatively low power LM339N, but that seemed to eat up too much power. I switched to a TLV3701IP, which has push-pull outputs which means one less resistor, but it’s designed for a Vcc of around 2.5v. This meant that the comparator would switch off before the LED ran out of power. So reached back into my parts bin and went back to an open-drain output comparator, which are more popular anyway. I used an MCP6546, which is designed for a Vcc down to 1.6v and that switched pretty well.
I added a voltage divider to control the set point of when it turns on, and I also added a resistor for hysteresis, which I’ll talk about later.
Pretty much, all it’s doing here is comparing the voltage stored in the capacitor against the voltage from the solar panel. An alternative design would be to use a voltage shunt to generate a reference voltage, but it seems to work fine this way and it’s also probably proportional to the amount of sun you receive.
Switched capacitor drive
All of the MD3 versions were about the same before this. The big difference comes with driving LEDs.
For a bunch of my designs, I’ve just used resistors, either a default 1k for signal LEDs or a calculated resistor.
I’ve also used a few different linear LED drivers. One problem is that most of them are designed for a relatively high amount of dropout. A CL2N3-G really isn’t designed for low voltages like this. The CAT4019/CAV4019 is a lot closer, but it needs a Vcc of 3V and it drops 0.4V.
MD3 v1 used a MAX1916 low-dropout linear LED driver. This is designed for a Vcc down to 2.5V and has a dropout voltage of 0.2V or so, so it was able to drive LEDs fairly well.
I was digging around and found the MCP1253-ADJ regulated charge pump IC. The problem with a charge pump is that they aren’t nearly as efficient as a switching power supply that uses an inductor. On the other hand, you don’t have to deal with buying just the right inductor. I was able to use the ceramic capacitors I already had to wire the circuit up.
MD3 v2 used a circuit from the MCP1253-ADJ datasheet that uses the voltage drop of the LEDs as a constant-current drive, which worked, but it needs an LED to be on constantly in order to hit the right voltage, which is more useful for something like a flashlight.
MD3 v3 uses the same MCP1253-ADJ regulated charge pump, but instead, because it’s powering a set of LEDs and their logic, I just set it to 3v or so.
The voltage is determined by the feedback pin: 1.21 * (1 + R6 / R7). Because you are dividing the resistors, you can actually write out 33k as 33 or 33,000.
I’m connecting the output of the comparator to the SHDN pin, which means that we’re back to the positive attribute of the SIMD1v3 circuit: When there’s power, the circuit is powered, otherwise it’s quiescent.
BEAM Nv Neuron chains for LED pattern
As far as I’m concerned, a blinking LED is boring. And it grabs the eye too much.
The Nv neurons that BEAM electronics work are kinda sorta vaguely intended to work a bit like a real neuron. When BEAM was a thing, a lot of folks were able to create fairly good walking robots with them. Like a real neuron, it accumulates “input” from it’s dendrites until it triggers in an all-or-nothing fashion.
They also represent something that’s analog, relatively easy to wire, and ripe with opportunities for interesting patterns of LED movement.
Pretty much, a single Nv neuron is a Schmitt-trigger inverter (generally a 74HC14) plus a resistor and a capacitor.
What I ended up doing was using two neurons to create a loop (They called that a Bicore), where each of the neurons will then trigger a secondary chain of neurons. In the schematic, the bicore is the lowest loop and you can see that the output of the first neuron triggers the middle string and the second neuron triggers the top string.
Also, some of the LEDs are wired up positive, others are wired up negative.
And finally, hysteresis
I mostly was prototyping by using my workbench light as a “sun” source up until this point.
The big test was leaving it out by my back patio window while I worked and then noting when it came on.
What I found was that it was flipping on-and-off a few times as the sun went down, which is probably at least partially because the capacitor starts to drop voltage as it uses up power (thus moving one of the two inputs to the comparator) and that’s dropping faster than the sunlight. It’s turning on to full power when it does, so it’s not quite as bad as burning energy to dimly light the LEDs, but it’s still not good.
Thankfully, this is a normally expected case for comparators. You just need to add a bit of hysteresis. With a comparator, that’s by adding some positive feedback, where you direct a little bit of the voltage from the gate at the positive input.
There’s two ways to do this: You can add do a bunch of math, or you can throw some resistors at the problem and hope it works. I took the second approach.
It turns out that you need to be careful while doing this with a comparator with an open-drain output. See, the pull-up resistor and the hysteresis resistor can turn into a voltage divider, if you are too close in value. TI’s reference design suggests that you want the hysteresis resistor to be at least 100x the value of the pull-up resistor. At the same time, you probably want the pull-up resistor to be a relatively high value just so that you don’t waste a lot of power pulling up the gate.
In my case, I ended up taking the highest value resistor I had handy, an 8.2M Ω, and then worked backwards for the pull-up resistor and the rest, which eventually got me reliable triggering. Because it’s feeding back voltage, I found I had to add about 100k Ω extra resistance to the high side of the voltage divider.
I’d like to note that configuring the comparator is a pretty great example of the primacy of microcontrollers over analog electronics, because expressing relatively sophisticated logic for that is really easy in something like an AVR.
- An comparator is a pretty reasonable way to trigger a nocturnal solar engine, but only if you hunt down a good nano-power one.
- BEAM-ish circuits are pretty happy with a solar panel with a VOC around 6.2V and one that puts out maybe 200 mA of power.
- MAX40200 and other similar ideal diodes are pretty handy replacements for real diodes in BEAM solar applications.
- MCP1253 and other similar charge pumps are pretty useful.
- I never saw it really described in anybody’s BEAM robots, but you can create delay chains with Nv neurons.
The complete circuit:
Obviously, if you were to make this yourself, you might want to replace R1 and R3 with a 100k trimmer pot or so. Also, as I said earlier, the pin numbers for U2 are for the SOT23-5 version, not the DIP-8 version. All of the capacitors except for the supercapacitors are just fairly generic ceramic general-purpose through-hole parts.
I’m at a good stopping point where I’ve got a schematic that represents something I’ve tested on the breadboard and now I can take everything off the breadboard and use it for something else.
Obviously, I’m just describing the topology. But at this point, it’s “good enough” so that I can build glowing art projects that this circuit can be stuffed into. So I’m probably going to end up with the diodes-capacitor-comparator-charge-pump section of the circuit into a PCB and the BEAM-LED circuit on a second PCB.
And I probably need to dig even further into the power drive electronics.