Wednesday, December 11, 2013

First week with the Volt

We're around 10 days in, and we've had enough time now to form some general observations about the cost.

On the highway, as a pure hybrid, the volt gets around 32 mi/gal. Not bad, and that is a worst-case scenario for a hybrid. This really only impacts us when we go on a long trip, but it is almost 10 mi/gal better than the van, and 5 mi/gal better than the old Passat.

As a pure EV, we seem to be getting just under 2.2 mi/kW-hr. That's spectacularly bad for an EV. The Fit EV (which we have dubbed the Blueberry in a nod to Psych) gets 4 even with my lead foot driving style. Tesla claims 3 for the Model S - even with its ginormous battery. 2.2 mi/kW-hr is just over 70 MPGe.

Chevrolet, in their informational data shown either on the web or in-car, shows a downright obsession with MPG - which they calculate by dividing the odometer reading by the amount of gasoline consumed. They do keep a cumulative kW-hr intake that you can view on a charging detail page, but the prominent placement of MPG seems intended to fool you into believing that electric miles are somehow free.

We live in Santa Clara. We have perhaps the lowest electric rates in California. Even so, the top tier is 10.2 ¢/kW-hr, which is the equivalent of $3.41 per gallon in energy equivalent terms. That's cheap, yes, but hardly "free." Now, granted, some charging stations - like the ones we have at work - are free, but this is going to be the wife's car, and she's likely to do the overwhelming majority of her charging at home.

So what are the final numbers? In terms of money per mile, the Fit EV is 2.55 ¢/mi. The Volt as a pure EV is 4.63 ¢/mi. On the highway, as a hybrid, with $4/gal gas, it's 12.5 ¢/mi. Of course, that's purely the cost of energy, and it assumes all kW-hr are 10.2 ¢ and all gas is $4/gal.

Clearly, "don't believe the hype" would be overstating it. As an EV, the Volt is almost 3 times less expensive per mile than it would be as a hybrid. But I do think that Chevy's pushing straight MPG is a bit disingenuous.

Tuesday, December 10, 2013

What is the plural for "Hydra?"

There are now two Hydras in the world.

We got my wife a Volt, so we are now a two EV family. And instead of installing a second charging station, I built us a Hydra. We spent a week moving the plug back and forth, but I was always nervous that I'd forget to charge one of the cars. And if it was the Blueberry, that would be a particular problem (that's our name for the Fit EV).

There were no particular surprises, but a couple lessons learned:

1. The new Leviton cables don't have a proximity wire in them. That's not good for Hydras, though they do still work. The new cables are also thicker, so they probably require a CG-17 instead of the 16 from Polycase. I don't know if it was that it is cold tonight or the cables are new, but they're quite stiff.

2. I simply must remember to watch out for protrusions near the edge of the internal panel. Two standoffs wound up colliding and I had to use a Dremell to cut them off.

3. I cut myself stripping the outer jacket. It wouldn't be a Hydra if I didn't bleed making it I guess.

4. I had originally used a right-angle plug for the i2c LCD connector, but that hit a standoff for the LCD, so I had to bend it up.

5. The new box I chose from Polycase has much more room inside, but at the cost of, well, being bigger.

I had intended to take a bunch of pictures to make a tutorial on building a Hydra... but then I got into actually building it and forgot.

Sunday, December 8, 2013

Questionable consequences

I recently bought a toaster oven and immediately took it apart. It is now a surface mount reflow soldering oven, but that's been covered in detail elsewhere.

As I was cleaning stuff up in the garage, I ran across the instruction manual for it.

So what?

This little snippet caught my eye and made me chortle:


LOL. Or what, exactly?

I kind of get where they're coming from. The surfeit of ambulance chasers we've grown in this country during the 20th century has made CYA an all too familiar manta anymore. And that's kind of a shame. But when I took the first screw out of the back of that oven, I knew right then that I was abrogating the manufacturers warranty and taking complete responsibility on my own.

I thought that the demise of Heathkit and the move in the electronics industry to surface mount spelled the end of the electronics hobbyist. But the hackers adapted and overcame, and now anyone with a very modest investment can create things virtually indistinguishable from commercial products, thanks to the likes of Eagle,  OSHPark and the Arduino project.

Sunday, December 1, 2013

Alternative controller idea... all-in-one backpack

It occurred to me today... I've been trying to reduce the cost of the controller board by shrinking the board. And that works, but the most expensive component is the LCD display backpack.

That got me thinking... Is there room on the backpack form factor for both the backpack's display i2c adapter circuitry and the Toast-R-Reflow controller?

And, sure enough, there is.

The board price goes up a bit - it's now $7.50 each instead of closer to $3 - and you need to add a LCD display ($11 on DigiKey for a monochrome backlit model - the Toast-R-Reflow doesn't really need the fancy RGB backlighting) and a handful of other SMD parts.

The net result is that it looks like I will be able to put complete controller assemblies for $40 each as opposed to $25, and then you need to buy a $30 LCD display backpack (or the $25 AdaFruit shield).

If you feel brave, the board is shared at OSH Park, but the basic controller design hasn't been fully tested yet, so no guarantees, at least at the moment. But if the basic controller design works, then this variant will be my next attempt.

Scarlet's new Chevy Volt

Anyone who lives in Santa Clara really ought to have an electric car. Santa Clara's municipal electric utility, Silicon Valley Power has maybe the cheapest rates in the entire state. The upper tier of 10.2 ¢/kW-hr equates to around $3.40 per gallon of gas equivalent. And, of course, an electric car is about 3 times more efficient than a gasoline car.

But unless you buy a Tesla, it's impractical (at least today) for a family to do entirely without gasoline power. So when it came time to trade in Scarlet's car, we looked purely at plug-in hybrids. Unfortunately, that cuts way down on the choices. It amounts to choosing between Chevy, Toyota and Ford. We wound up going with the 2014 Chevrolet Volt. We went with the cheapest model, which was around $7500 (or so) less than the tricked out version.

What we miss with the lower model is some of the new high tech driving stuff, like parking assist, lane departure warning and (I think) radar assisted cruise control and built-in navigation. The Volt does have OnStar assisted turn-by-turn navigation, but the way that works is that they download the directions as a set of GPS waypoints. The car doesn't actually have a map at all. If you go off-route far enough, it tells you that you need to phone home again to get updated routing. It's good in a pinch, but if you want an actual map, you need to use your phone.

I took a trip to San Francisco. Highway driving is where EVs and Hybrids actually don't do so well. 11 kW-hr of electricity took me just under 30 miles at 75 mi/hr, and the gasoline engine was able to get around 32 mi/gal after that. Not bad, and it sets expectations for the occasional road trip. But apart from those road trips, it's quite likely that Scarlet won't use a drop of fuel, and will get more like 3 mi/kW-hr or so (the equivalent of around 100 mi/gal), again, at a "fuel" cost of under $3.50/"gal".

Oddly, the cabin is configured as 4 bucket seats. Where normally you'd be able to squeeze 3 small folks into the back seat, that's not an option here. However,  the back seat does come with a center console of a sort, and the hatchback area is opened to the back seat. There's also power outlets for both rows of seats, as well as a power port in a little cubby on top of the dashboard (I guess for standalone GPS units?), and the front also has a USB jack nearby used for connecting to the entertainment system (and, yes, it does charge an iPhone with the Lightning cable). Connected that way, it can also control Pandora running on the phone, which is quite nice. Siri works more or less as you'd expect (via Bluetooth), but you must engage her by using the home button on the phone.

I'm not sure how I feel about OnStar. They can place hands-free phone calls for you, but they charge extra for that, and you're not using your phone to make the call (so I'm not sure what the caller ID shows for the people you call), so we didn't opt for that. You can ask them to send down navigation routes, but there's no map. They also have an emergency response system built-in, so they know when the airbags deploy and stuff like that.

The efficiency displays are slightly disingenuous, since they talk about an overall miles/gallon, which they calculate by dividing the odometer by the amount of actual gasoline used. The implication there is that the electricity you "pour" into the car has no cost, which isn't really accurate. Chevrolet salesmen perpetuate this little bit of faulty arithmetic as well. It's true that (at least today) many public charging stations are free, but that's certainly not the case for charging at home.

The only other gotcha we ran into was that by default the Volt is set for a "charging cable theft alarm." What that means is that if you disconnect the J1772 plug without the key being nearby the car alarm will go off. That happened at 10 PM the first night when I moved the plug to the other car, and I turned that nonsense right the heck off.

Anyway, so far it's going pretty well.

Saturday, November 30, 2013

Blinky LED earrings

Getting into SMD fabricating has really opened the doors to all sorts of new ideas.

My first attempt at a wearable was sort of inspired in part by FLORA and the other wearable stuff at AdaFruit.

It's a 1 inch diameter board with 8 SMD LEDs mounted equidistantly around the outer edge. Each is hooked up to a digital pin on an ATTiny84. There's also a micro-switch input to the controller and the whole thing is powered by a CR1225 battery. A pair of them would be a pair of earrings.

Here, the purple color of OSH Park's boards is actually a good thing - the hope is that the actual earrings themselves are dark and unobtrusive, or at least as much as they can be. The usual garish green solder mask color would be awful in comparison.

The button will be used to select different blink patterns.

It's asking a lot for a CR1225 to drive even a single LED, so although the board was designed with series resistors for each LED, the initial prototype is going to be stuffed with "0 ohm" parts. The blink patterns are going to be designed so that only a single LED is on at once.

The real question is still going to be whether it's going to work at all. The risk is that pulsing the LED will cause the voltage from the battery to drop enough that it hoses the controller. I don't know what I would do to fix it, though, because there isn't room for something bigger, like a CR2032.

But the larger point here is that with through-hole versions of these components, there's just no way this would be even worthy of consideration.

I got the SMD LEDs in the mail today and broke a couple out to try them with a pair of AA batteries. I probably overdrove them a little, but they were quite bright.

We'll see.

Friday, November 29, 2013

Toast-R-Reflow: revised schematics

I've revised the schematics a bit. First, the power board:
 There's no actual change to the circuit here, just improvements in the layout.

The controller:


The change here is that a bunch of passive components have been added to the thermocouple input. There is a 1M resistor from the negative pin to ground. I'm not 100% sure why, but it's what the data sheet recommends. The RC network on the thermocouple pins is recommended to prevent RF from affecting the readings. Other than that, it's the same.

Thursday, November 28, 2013

Toast-R-Reflow: how-to summary

This is intended to be a sort of "landing page" that summarizes the Toast-R-Reflow project. Now that you're here, you can do a deeper dive by checking out all of the posts here with the toast-r-reflow label.

The internet is full of folks who have made their own SMD reflow oven by hacking a toaster oven. I'm not the first, and certainly won't be the last. The reason you have to hack them at all is because the controls that come with these devices are not nearly precise enough to follow a reflow soldering profile. Gutting the controls that come with the oven and giving control of the heating elements to a microcontroller (like an Arduino), and providing that controller with the ability to read the temperature from a high-temperature rated thermocouple is the task at hand.

Oven heating elements run with AC line voltage power and require hundreds of watts of electrical power. In order for a microcontroller to safely control such a load, it must be galvanically isolated. Most folks have used a Solid-state relay to do the switching, but those are very expensive. Triacs have been around for a long time now, and some are quite hefty. They can be controlled by opto-isolated driver triacs quite simply, with the result that the entire high-voltage switching assembly can be made on one board and built inside the oven where the original user controls were located. The input side of the optoisolator can be wired to low voltage wires and routed outside to the controller with complete safety. The triac circuit is inexpensive and simple enough that putting two copies of it on the board made it possible to cut the current requirements in half (so long as you can divide the load evenly between the two sides). The design is rated for 8 amps per channel, or just short of 2000 watts of power combined.

Lots of folks have bought a commercial PID controller to operate their oven. A PID controller is designed to provide an analog control signal, but that can be easily translated into a digital control signal by using a slow version of PWM. The Arduino has facilities for automatic PWM, but we're talking about a pulse frequency of closer to 1 Hz - much easier to simply do it in software. It should be noted that this is how microwave ovens provide proportional power as well - when you ask for 50% power, the microwave will generate power for one second and then stop for one second. This mechanism makes element control quite easy - you just need to be able to turn them on and off. Commercial PID controllers are also, however, quite expensive. Adapting an Arduino or - even better - an Atmel ATTiny controller to do the job can be done quite inexpensively. I started down this road by breadboarding the controller and designing the permanent controller as an SMD board. The power board was made with through-hole components simply because there are aren't many components and they need to have high voltage ratings. It also served to solve the bootstrapping problem - you build the power board, convert the oven and run the cycles at first with an Arduino and/or breadboarded controller, then use that to reflow the permanent controller.

For a while now, I've been using the OpenEVSE store's 2 line RGB LCD for just about everything. They're the same as the AdaFruit RGB LCD shield, but arranged as a "backpack" design with a 4 pin SIP cable connection back to the controller board. The particularly nice thing about these displays is that you can see the backlight color from much further away than you can read the text, which is useful for simple status reporting. The backpack/shield also allows you to read 5 buttons (we will only need one as a 'start' button) all over a single i2c slave.

The thermocouple needs a cold junction compensated amplifier. There are quite a few of those out there to choose from. The AD8495 is the best answer in terms of cost and simplicity. The original breadboard prototype was made with an AD595AQ, which is an older device and 3 times more expensive. To make the breadboarding easier on the next guy to come along, I designed an AD8495 breakout board that can plug into a breadboard and has a pair of screw terminals for a K type thermocouple. The AD8495 simply outputs a voltage that is 5 mV for every °C. This can be fed directly into an Arduino / ATTiny analog pin and read with analogRead() and scaled appropriately. +/- 1 °C is fine for this application.

Finally, an ATTiny85 is a perfect choice for the controller. It has a USI interface that can be converted into i2c with the TinyWireM library, and it has besides that two digital pins and one analog input pin - exactly what we need.

As for the oven, a Hamilton-Beach 31138 from Fry's was what I more or less randomly chose. It turned out to be an excellent choice. It can keep up with the reflow profile I chose and has yielded quite good results. It was also easy to disassemble and convert to its new use.

I'll be stocking the power and controller boards in my store if anyone wants to follow in my footsteps. The firmware for the controller is over on GitHub.

Toast-R-Reflow: the bottom line

The power board is rated for 8 amps per channel. That limitation is a factor of two things - the traces on the power board that connect the oven's innards to the traics, and the ability of the triacs and heat sinks to dissipate heat. According to the data sheet of the BTA-20 triac, at 8 amps, it generates 10 watts of thermal power. The case-to-mounting-tab is rated at 2.1 °C/W. The heatsink I chose has a rating of 5 °C/W. So 7.1 * 10 is 71 °C temperature rise at rated power. The maximum junction temperature is 125 °C, so that means that the maximum ambient temperature for the power board is 50 °C, or 122 °F. I stuck a thermometer in one of the vents and ran a cycle and the temperature near the heatsinks never rose above 100, let alone above 122. That's a bit of a surprise, given that that chamber is right next to an uninsulated metal box being heated internally to 225 °C. Credit the ventilation, I guess. Undoubtedly it's so liberally ventilated to insure that the original user controls remain cool to the touch during use.

As for the traces on the power board, they're a minimum of .1 inches wide at the thinnest point, and they're on both sides of the board. OSH Park's boards use 1 oz copper. Since we're using both sides, that's either an equivalent of 2 oz copper or .2 inches wide, take your pick. Plug those into this calculator and you get that a maximum current of 8 amps requires 104 mils of trace width with 2 oz copper on external (air facing) traces. Most of the current-bearing traces are wider than that, but it does become quite narrow right where the triac pins are.

The boards are $7.50 each from OSH Park. The BOM from DigiKey is just under $10, plus shipping and tax. I took a look at DigiKey's catalog, and there are SSRs they stock that are competitive with this design, but they don't blow it away in either price or performance, and the best option I found would have been more difficult to deal with from a thermal perspective. Standalone SSRs, like those I've seen people use on the Internet, are many times more expensive.

The controller boards are $4 each from OSH Park. The BOM is $12. You also need an OpenEVSE RGB display backpack, which sells for $35. And the oven was $40. So, in short, the whole thing was around $115. 

Reflow oven safety

When converting a toaster oven or skillet into a reflow appliance, some thought must be given to safety. There are obvious safety precautions concerning line voltage and heat, but one you may not think about is the fact that you started with an appliance meant for treating human food.

Even if you use RoHS solder paste, the flux is nasty stuff and it vaporizes. You can count on it getting everywhere the first time you use it. In short, once used for reflow, you must never again use it for food. And that means anyone who might come across it. Some day you will throw the oven away. You don't want someone to find it and try to repair it and put it back to use as a toaster.

So I liberally wrote on mine with a sharpie. The handwriting is bad, but hopefully the message is plain and will survive until the oven is reduced to scrap.


You'll notice that the original controls are still there. I just didn't bother to remove them, but they aren't connected to anything and don't work. The light doesn't light up anymore.

The low voltage wires just come out of one of the vents, but that's ok. The worst that could happen is that they short out and draw 30 mA of 5 volts or so.

The SMD adventure begins in earnest

Ordered my first bulk order of SMD parts from DigiKey last night. 0805 1/8W resistors are 10 cents a piece in single unit quantities (plus, like, $3 shipping), but a reel of 5000 of them is only $15. And for me, that's easily a lifetime supply.

I waited until now because I wanted to get some experience with the reflow oven before committing to it as the path forward.

I can now say with some certainty that the 1.6 version of the Hydra will be the last through-hole design. Same with the current version of the EV Sim 2.

So what do you buy when starting out?

Well, first and foremost, 0.1 uF 50V 0805 ceramic capacitors. Every chip needs at least one mounted nearby across its power supply pins. Next, 330 ohm resistors. They're series resistors for NPN transistors and LEDs. 10K resistors for the pull-up on !RESET for every AVR controller.

I also got some parts to flesh out the reflow oven controller - I suspect I may sell a few of those. For them, I need the rest of the passive parts for the AD8495 thermocouple amp - 1M, 0.01uF. Also, 0.33 uF for the regulator. I also got a tape of regulators, input protection diodes and Tiny85s.

My big problem right now is firmware. I've got a number of ideas for the Tiny85, but they all involve driving a 2 line LCD display over i2c. TinyWireM, LiquidTWI2 and the Arduino core by themselves seem to take up most of the available flash! I can't hardly believe that's true. I've got to look into it to see where all the space is going.

Wednesday, November 27, 2013

Toast-R-Reflow: First success

I got the power board installed in the oven without too much difficulty.


This is a picture of the mounting for the power board. I drilled 4 holes in the outer sheet metal enclosure. There was a blank spot near the top (the piece is shown here upside down) where there were no ventilation holes (you don't want to be able to accidentally poke something through a vent and touch a high-voltage PCB trace) and mounted the board there. I got lazy and just shoved the 3 low-voltage wires through a vent slot nearby. I had planned on mounting a grommet, but I got lazy.


This is a view with the top put into position enough to actually attach the wires. The hot line got re-crimped with a new QD connector because the original one was the .178" size and it wouldn't fit the terminals I had mounted on the board.

If the heatsinks look a little funky, it's because it's the prototype board. I didn't properly place holes for the pins on the heatsink to sit in, and the triacs aren't perfectly positioned. The boards that are in the store now are better, but these will do for now for me.

As for the thermocouple, I just ran that through the side of the door. This lets me position it nearby the board every time I get ready. I might come up with a better solution later.

The first board that was processed by the oven was an EV Sim Mark II SMD board.

I used a template and some ChipQuik paste. It was an absolute mess. I am fairly certain that I'm not using the template right. I wound up with sort of "blobs" on the pads and in the area surrounding each. I decided to give it my best shot.

And it worked!


Every part you see there except for the through-hole components and the two parts I had to rework (the protection diode was backwards - the label was very hard to read, and the power jack has a boss that doesn't match up with the hole where it's supposed to land. I had to lop it off with an Xacto knife and resolder it), every part was "nudged" into a blob of paste and the oven took it from there. Most of the parts weren't even completely straight, but the magic of surface tension fixed that.

What's more, I was able to program the controller without mounting the through-hole ISP socket. I got a Pogo ISP adapter from SparkFun, and this was my first opportunity to use that as well, and it also worked perfectly. I went ahead and mounted the through-hole socket anyway, because this is going to wind up in the store, but at least for my own projects, I may not bother anymore.

I'm going to try to do the other two EV Sim II boards that I got in that OSH Park order tomorrow. If those work as well as this one did, then the next step will be for the oven to reflow its own permanent controller board. And that will happen as soon as those boards come back from OSH Park.

Tuesday, November 26, 2013

Toast-R-Reflow: Initial success

The power board prototypes arrived today. I built one out and connected it up to the oven. It works perfectly.

I fed it with a 5 volt power supply and a 200 ohm resistor and it turned the elements on and off like a perfect light switch. I left it on long enough for the elements to glow red hot and then quickly unplugged everything and checked the triac heat sinks and they were cold. I've now got no doubts at all that it's going to work. Next step will be to build it into the oven and button everything up.

Anyone who wants to follow along should now feel confident in getting their own power board from OSHPark. You can find the design here. It's $22.40 for 3 copies of the board, but I'll sell them in single quantities in my store.

The power board is designed to switch up to 8 amps per channel (this is based on the width of the current carrying traces on the board and the heat capacity of the heat sink). As long as you can split the load in half, you should have no trouble switching 1500 watts.

To use it, you bolt a QD male terminal onto each of the 3 large holes in the middle of the board. The centered one connects to the hot lead of the AC input, and the other two go to the load - in this case each of the two heating elements in the oven.

The 3 terminal block at the end of the board has a common cathode pin and an anode pin for each of the two channels. You must use current limiting resistors on each anode line. The LED in the opto-isolators is rated for 30 mA with a forward voltage drop of 1.5 volts. Make sure you do not exceed the opto-isolator's maximum current rating of 50 mA. You should have no trouble driving them with an AVR digital pin directly with just a current limiting resistor in series.

Monday, November 25, 2013

The irritating thing about hardware design

Being a software guy by nature, I'm used to very rapid design and implementation turnaround. You edit the source code, compile it, upload it, try it, find bugs, lather, rinse, repeat.

What's chafing my hide now that I'm doing hardware projects is that the turnaround time to get a PCB fabricated is 2 weeks.

All I can do in that 2 weeks is obsessively go over the design that I've already paid for. Sometimes I wind up finding a whopper of a mistake and have to order a new design. Then I still get to wait a week to receive a package in the mail with my mistakes in it. I open the envelope, smirk, and throw the boards right in the trash. It's disconcerting.

My latest mistake is that I thought a particular part that I want to use was some sort of narrow variant of a SOIC-8 package. Um, no, it's an MSOP-8. It's much smaller. There's no way the leads are going to fit the pads on the board. So the first two versions of the Toast-R-Reflow controller that I've ordered are all garbage.

Saturday, November 23, 2013

Toast-R-Reflow theory of operation

If anyone cares to know how the Toast-R-Reflow actually works, it goes something like this:

The power board consists of a pair of MOC3020 photo-triac drivers, each triggering the gate of a BTA20 high current triac. The MOC3020s are directly connected to a set of screw terminals intended to be run to the logic board, which will be expected to provide the correct driver voltage and current for the LEDs.

The actual triac circuit is straight out of the datasheet. I confess I am not 100% sure of the purpose of each of the parts beyond the optoisolators, but each of the triac drivers is rated for 8 amps of current (this rating is due mainly to the width of the traces on the board running to the triac pins and the heatsinks' ability to get the heat out of the triacs when they're installed next to a box being heated to 225 °C). This means that if you can drive the two elements separately, you can handle up to 1920 watts of power, which should be plenty for a consumer grade toaster oven or hotplate.

The controller board has an AD8495 thermocouple amplifier on it. This amplifier outputs a voltage of 5 mV per °C detected on the thermocouple. This voltage is fed into analog pin 3 on the ATTiny controller. Two of the pins of the ATTiny are used as the i2c bus to drive the external 2 line RGB display, which also as a side effect handles the start button. Two of the other pins of the ATTiny are power and one is RESET, which leaves us with two digital out pins that we can send off to the power board (going through 150 ohm resistors first in order to produce the correct LED driver current).

The software uses the Arduino PID library to turn the elements on and off with a sort of exaggerated PWM method. The PID will output a floating point number between 0 and 1000, and that's the number of milliseconds out of each second that the elements will be powered (this is similar to how microwave ovens deliver fractional power). The sketch will attempt to turn the elements on separately, so that if the duty cycle is 50% or less, they won't be on at the same time, which will reduce the instantaneous power draw somewhat.

One point of note is that the one of the pins of the controller used for programming is also one of the element control lines. This means that that line will have a great deal of random activity during programming. Because of this, it's important to make sure the oven is unplugged during programming, otherwise you'll be pulsing the elements randomly and they could conceivably overheat.

I beat SparkFun! :)

SparkFun sells a small board that will adapt a 6 and 10 pin AVR ISP connector to a breadboard. I had been using a special cable that I made with a 14 pin DIP IDP plug on one end and the 10 pin 2x5 IDP socket on the other end. That works because the DIP plug can split the center channel of a breadboard. But I do think that SparkFun's answer is a touch cleaner. What bugged me was the prospect of a 95 cent order with, like, $2 in shipping. So I sat down with Eagle and at the end of the day I made a design that costs $2.80 for a batch of 3 (so 93.3¢ each and free shipping) from OSH Park! That works out nicely because it means that I can permanently breadboard an ATTiny85, an ATTiny84 and an ATMega328P all at the same time for prototyping and pick the appropriate one for the design I'm working on. Each can have the power supply (with bypass cap), an i2c bus connection to a display shield, and ISP all ready to go - sort of like a poor man's Arduino.

If you want a batch of them, they're here.

Wednesday, November 20, 2013

Toast-R-Reflow timing

I got a better thermocouple today, so I tried the timing test again.

This time, 20-150°C took 2:22. 150-225 took 2:34, then back down to 150 took 1:50. Cooling down from 150 took longer than I cared to time, but that doesn't really matter so much.

So that means rising up to Soak is at just under 1 degree per second. Rising up from Soak to Reflow happens at just under half a degree per second. Falling from Soak happens at just under 3/4 of a degree per second.


Sunday, November 17, 2013

Toast-R-Reflow schematics

Here are the schematics for the two boards that comprise the Toast-R-Reflow project.



This is the controller board. In the upper left corner is the thermocouple amplifier. Below that is the 5 volt power supply. The input jack is a standard 2.1mm barrel connector. The rest of the circuit is the micro controller and its I/O. In essence, the controller takes in the temperature from the thermocouple and controls two digital output lines that go off to the other circuit (below). There are 330 ohm resistors on those two lines because they're intended to drive an optoisolator input, meaning that you want around 20 mA of current or so - enough to light up an LED. There is an i2c connector on the board that leads off to an OpenEVSE or AdaFruit RGB LCD backpack/shield, which is also how we get a pushbutton input (used to start the reflow process).

This is the power board. It's a separate board because it has 120 volt power running through it. Note that the path from the hot terminal through the triacs and to the output terminals are specified to carry up to 750 watts of power, so they're going to need to be very wide traces on both sides of the board.

The triacs are also going to need fairly substantial heat sinks. Even more so because they're going to be in proximity to the actual heated space of the oven. I think we can safely assume an ambient temperature of 50 degrees C, at least. The triac data sheet says that at the design current, we can expect it to dissipate 10 watts of thermal energy. The heatsinks I've ordered have a 5 degrees C per watt rating. Combined with the triac mounting terminal spec, the online calculators I've seen suggest that this ought to be a combination that should be acceptable.

The power board is a separate board so that it can be built-in to the oven. The two isolator input lines and ground can safely be routed out of the oven to the controller board, along with the thermocouple cable.

The three large terminals on the schematic are actually in the SparkFun electro-mechanical eagle library. They're #4 holes designed to be electrically connected. #4-40 hardware will be used to attach QD male connectors directly on the board. The QD female connectors on the wires of the oven will plug right in.

Introducing... Toast-R-Reflow

I've been really into microcontroller engineering of late. I've created the J1772 Hydra, and the EV Sim Mark II as well as a whole bunch of little experiments.

I attempted to build a surface-mount version of the EV Sim II, and hand soldering all of those tiny little parts was a painful exercise. I was going to give up on the idea, but I was turned on to the concept of reflow soldering.

In a nutshell, you get a circuit board fabbed just the same way as always. I use Eagle as my CAD software. OSH Park is my board fab of choice, and they'll take an Eagle .brd file as source material.

Next, you must create an SMD pad template file. You do this by exporting the "cream" layer from Eagle as a Gerber file. The file is a description of all of the places where soldering will be taking place. You send that off to Pololu and have them make you a paste template.

The next step is similar to silk-screening a T shirt. The template is a sheet of plastic with laser-cut holes where the Eagle "cream" layer had them. You anchor that template on top of the board with all of the pads and template holes lined up. You then apply reflow soldering paste to the template and use a metal squeegee (I'm going to use a spackle knife) to scrape it off the template surface, leaving only the holes filled in.

After removing the template, now you have paste applied to all of the pads. The paste, I am told (I haven't yet done this), is like wet cement. You use tweezers to place all of the parts and "smoosh" them into the paste slightly. The paste will hold them in place while this is going on. The "Big Boys" use pick-n-place robots to do this work.

Once the parts are all in place, you carefully move the board into a reflow oven. The oven will heat up, very precisely following a specific time-temperature profile. It will gradually heat the entire assembly up to 150 degrees C, then hold the temperature there for a minute and a half, then as quickly as possible it will crank up to 225 degrees C and hold that for 30 seconds. That will be hot enough to activate the flux in the paste, which will clean the pads and parts, and then melt the solder, causing it to "flow" to the pads and parts. Finally, the oven cools, but no more quickly than allowed lest the parts suffer from thermal shock.

Commercial reflow ovens are outrageously expensive. That's to be expected with a low volume piece of commercial equipment. But lots of hobbyists have built their own reflow ovens by modifying toaster ovens to add microcontroller-based heating control with thermocouple temperature monitoring (all of this in the interests of increased precision). I've decided to go down this road too. None of the approaches taken by any of the other Internet hobbyists I've discovered look to me like they're... optimal somehow. Some of them build the entire retrofit into the oven, which looks excessively complicated to me, and others externalize the entire mod, which seems less safe to me. Most folks buy a solid-state relay, which is outrageously expensive. For less than a quarter the cost, I designed and purchased the parts for a triac-based opto-isolated power switching board. That board will be built inside the oven. The OEM controls will all be ripped out and the elements and hot line from the AC plug will be connected instead to the board, and the board installed in place of the original stuff. The optoisolator inputs will be connect to to a cable running out (along with the thermocouple cable) to the controller board. I've designed a small controller board (ironically, it's made with SMD parts) with an ATTiny 85 and an AD8459 thermocouple amplifier. I'm fairly confident that I could productize the two boards as a "conversion kit" for around $30 (add a 2 line LCD display and i2c "backpack" board, a button, a thermocouple and a toaster oven).

While I was ordering the parts, I bought a thermocouple probe and amplifier chip. I then went to Fry's and bought a Hamilton Beach model 31138. From examining it on the shelf, it looks like it's going to be reasonably easy to disassemble and modify. But before I make it impossible to return, I wanted to test it. I put the thermocouple in the oven and set it to 450 and turned it on.


It took 90 seconds to get to 50 degrees (all measurements are in Celsius. I'm going to stop saying that now), a further 67 seconds to get to 100, 78 more seconds to get to 150, 96 more seconds to get to 200 and then 63 seconds to get to 225. I turned off the heat at that point and the oven took 4:50 to fall down to 150 degrees.

At first glance, that doesn't look like very good performance, but the slow cooling has made me think that the problem is that the thermocouple is not agile enough. So I'm going to get a different one (this time not embedded in a big metal probe) and try again.

Meanwhile, I decided to go for broke. The oven is very easy to disassemble with just a philips screwdriver.


The left inside - the front is to the right.

The right inside, where the controls are.

Here are the wires of interest: red is hot, white is top element, blue is bottom. The rest don't matter.

Check the wiring... The hot line goes directly to the red QD on the table. The neutral line goes to the indicator light on the front panel and to the two elements on the far side of the oven. We won't bother hooking the hot side of the light to anything, so those two QDs will be wrapped in tape to keep them out of mischief.


There is a single piece of sheet stainless steel wrapped around the sides and top of the oven. You need to pull all of the screws on the back that hold this piece in place. There's one screw near the left (viewed from the front) rear bottom that also must be removed. Next, pop out the rubber inserts in each of the plastic feet and unscrew and remove the screws inside as well as the two larger philips screws between the feet. That done, the top/side sheet should pop right off.

Once that's done, cut and remove the two "rat belts" bundling the wires near the AC plug and near the top. Use a flat screwdriver and pop the QD connectors (each is inside a redish-brown rubber heat shield) attaching all of the wires to the controls. You'll wind up with one coming from the top element, one coming from the bottom element, and one coming from the hot line of the AC plug. There are some other QDs, but they won't be used.


Sunday, April 7, 2013

Enter the Honda Fit EV

I've leased a 2013 Honda Fit EV.

I'm not really one for "green" thinking. I've said more than once that I think that most of the things that are supposed to be good for the planet are either foolishly costly or ineffective or both. But if you find a way to save me a dollar, you have my attention.

I've talked about this a bit of Facebook, but I think it's worth adding a bit here about the math.

A gallon of gasoline has 33.4 kW-hr of energy in it.

Silicon Valley Power rates are 8.877¢ per kW-hr for the first 300 kW-hr and 10.205¢ for kW-hrs after that. 300 kW-hr isn't a lot, so let's assume the worst and say that it's the 10.205 rate. If you were to magically turn electricity into gasoline at 100% efficiency, you'd be able to gas up that way for $3.41 per gallon. That's not such a big difference, but it is a pretty good deal. But still, the cost of the energy isn't where the big difference is.

Gasoline car efficiency is traditionally measured in miles per gallon. EVs are measured in either miles per kW-hr or kW-hr per 100 miles. The EPA rates the Fit EV as a combined city/hwy of 29 kW-hr/100mi, or 3.44 mi/kW-hr. Convert that into mpg and you get about 115 MPGe.

Despite that, the Fit EV is almost a muscle car in its ability to launch itself off the line. I'd love to take a day off some day to make a trip up to Sonoma to try the quarter mile (of course, it means stopping in San Francisco to charge up... It's just always an issue). I'm pretty confident it could turn in a sub-15 second time. I'm an unapologetic lead-foot and this car is a downright joy to drive. If you put it in "sport" mode, you get a full 123 horsepower and a healthy 189 ft-lb of torque. That's only a little less than Volkswagen's TDI engine (140 hp and 256 ft-lb of torque, but the torque curve of a diesel engine is far narrower than an electric motor).

Though using electricity is a very efficient way to obtain motive power, it's horrendously slow to deliver it and difficult to store. The 20 kW-hr battery represents the energy in less than 2/3 of a single gallon of gasoline and weighs more than 800 pounds. By contrast, an 18 gallon gasoline tank is 600 kW-hr. If I had a 600 kW-hr battery, I'd be able to go almost 2000 miles between charges.

But even that isn't the big issue. The charger built-in to the car is rated at 6.6 kW. In other words, 6.6 kW-hr per hour. So it takes 3 hours to charge completely from empty. Recharging the mythical 600 kW-hr battery above at that rate would take 90 hours - almost 4 days. Even the CHAdeMO HVDC chargers they have now are 62.5 kW - 10 times faster (though it should be noted that the Fit EV isn't equipped with a CHAdeMO port, and frequent use of high-power charging will decrease battery life long term). But those require 3 phase 480v power feeds. My house has a 200A @ 240V service panel - that's only 48 kW, and that's my whose house.

With these sorts of limitations, EVs are reasonable "second cars." But you can't seriously consider taking one on a road trip. No, not even a Tesla. Tesla's strategy is to deploy so-called "supercharger" stations at strategic locations to enable road trips. They have one at Harris Ranch, one in Bakersfield, as well as in Los Angeles.

I'm sure Elon Musk has thought about this longer than I. But I think this strategy is misplaced for a couple of reasons. Let's use my occasional trips to San Diego as the basis for my argument. The trip is 450 miles and takes a total driving time of about 7 hours. It takes longer than that for the trip because of refueling stops (for the car and the driver). In a gasoline car, I've been known to make it in 8 hours or less. Refueling takes about 15 minutes.

The range of a model S is not particularly relevant unless it doesn't make it between Supercharger stations or unless it can "skip" one (no way). Tesla knows this and placed them strategically along I-5. They say they can charge about half way in half an hour. But half a charge won't get you to the next station.

This strategy will only work if the cars stay rare, which clearly is the opposite of Tesla's goal of selling cars (duh). But setting that aside, the trip to San Diego will require 3 intermediate stops for refueling, which will take around an hour each. So the 8 hour trip is now 11 hours.

No. It's just not going to work.

The only solution to this conundrum is temporary auxiliary power provisioning for long trips. This means one of three things:

  1. Liquid fuel powered pusher trailers
  2. Liquid fuel powered generator trailers
  3. Swappable battery pack trailers

Petroleum powered pusher trailers are actually a fairly mature idea. Many tinkerers out there have taken a front-wheel drive vehicle, chopped off the back half, locked the steering, added a trailer hitch and attached it to an EV.By contrast, the idea of using an engine and generator to power the car isn't so great. Scooting down the highway, the car requires something like 20-30 kW just to maintain highway speed. A 20 kW generator is going to be one heck of a trailer. Still, it has been done before (note, however, that the EV hauling this monster is an SUV).

I think the battery pack trailer has the best long-term prospects. Tesla could replace their supercharger stations with a trailer exchange station. Trading out trailers would take probably less time than filling the tank of a conventional car would. The problem there is that 40 kW-hr of battery weighs a good 800 pounds. That's bound to have an impact on the car's performance. Still, 3 100 mile battery swaps, plus the car's internal 150 mile range (remember, we're talking about a Tesla model S) is the 450 miles of the benchmark trip.

However you decide to provision auxiliary power, I think having it be available for temporary rental for road trips is the way to go. If the APU is petroleum (or methanol) powered, the agency renting it will be on the hook for proper maintenance of the emissions controls. Additionally, a rental fleet can be turned over more quickly as technology improves.