Archive for September, 2015

Microelectronics annoyances

Saturday, September 12th, 2015

About a year ago – maybe two, I’m not really certain any longer – I stumbled across the Arduino platform. Open source hardware and software for microcontrollers – the more I looked at it, the more amazing it was, for what it was and for it’s potential. I built out an environmental sensor platform on the Arduino with a very simple temperature / humidity sensor, and I’ve been sampling and recording temperature, humidity, and heat index in three locations in my townhome ever since. Combine that with RRDTool and Apache, and I have a graph of the trends over time to help me figure out heating and cooling efficiency, and to warn me of certain conditions via email. Freaking amazing, if you ask me.

Fast forward to two weeks ago, when I’m putting the final touches on my brew stand for homebrew, and I start getting serious about the control bits for the pumps and especially for the fermentation chamber, which is a 7 cubic foot chest freezer. What do I turn to? Arduino, naturally – so I order an Arduino Uno R3 and a temperature sensor. They arrive, I’m happy, and I start coding up the Arduino sketch (read: program).

Then I started running into problems. First, I was getting strange behavior on the serial port. When I was powered via a USB cable, all was fine and my sensor was working normally. When I switched to non-USB power via the Vin pin on the Arduino, the sketch wouldn’t start. Ok, I figured that out, there’s something wonky about the RX pin – it needs to be grounded when using non-USB power.

Then, I throw the ethernet shield into the picture. Half the time I boot, I get the IP expect to get, and my device is pingable, but it’s not responding to web requests properly. This is the same code I used on my existing environmental sensors, which have been working flawlessly for over a year now… Huh. After some Googling, I found some indicators that the library I was using was the incorrect one. So I switched to the v2 library, and I get even stranger behavior – an inability to compile the sketch. Back to Google. Next up – oh wait, this is a v1 shield – I need to get a newer revision of the ethernet shield. Off to Radio Shack.

I get home with my SeeedStudio shield, and it doesn’t work. I never get a pingable device. Back to the Google. Come to find out there’s a manufacturing flaw with the SeeedStudio shield that was noted in 2008 and still hasn’t been fixed. The recommended fix for the customer? Break a trace on the shield board – a trace which is about 0.1mm wide, and has other traces less than 0.2mm away from it that are necessary for proper functioning. Well, no – never getting an Radio Shack shield again. Order a v2 shield from Adafruit.

The v2 shield arrives, my code compiles, it uploads to the board – and I get an invalid IP. Oops – I forgot to read the product page that says I need the v2 library. Well, it didn’t work last time, so let’s see if there’s an IDE update – yes there is. Two of them, in fact. The Arduino project has evidently been forked, and there is much childishness and stupidity going on between the two forks in the form of lawsuits, threatening letters from lawyers, trademark claims, infringement claims, et cetera ad infinitum. And of course, neither new IDE will compile my code because of syntax faults in the Arduino equivalent of system libraries.

Summary so far: Arduino has gone to complete shit. It is no longer a viable microelectronics platform even for development much less production use. Wonderful.

This was Thursday, so I had some time. I ordered an STC1000 from Amazon, had it shipped to arrive Saturday (today as I’m writing this), hopeful that the COTS temperature controller would solve my fermentation chamber woes. It arrives, and all is well with the world – until I open it and start connecting it. The model I ordered had four connection points – sensor, input, cooling load, heating load – except the item I got didn’t have the connection point for the heating load. Not too much of a problem – I doubt I’ll be doing much heating, so let’s press on.

The temperature sensor cord is about 4.5 feet shorter than advertized. This is a problem – it won’t snake into my chest freezer nicely – and it’s not a flat cable, as the product description implied (but didn’t say explicitly, I admit), so I can’t really snake it in through the door opening. Then, I discover that I can’t effectively connect the line and load wires – the screw terminals are just a tad too small.

Great. Cheap Chinese knock-off crap. Effectively unusable for this project. Dammit. Ok, let’s punt (again)…

I have two spare Raspberry Pi’s, and a third I can repurpose if I need to – let’s try that. The good news, I can use the GPIO pins to directly drive the solid state relays controlling my chest freezer fermentation chamber. Woot, we’re ahead of the game here! The question at this point is can I directly sense the temperature with the RPi or do I need an Arduino in between? Thankfully, the answer is “yes” – because it’s a digital sensor, I can use the RPi directly. All I need to do is cable it properly.

So, I hook up the RPi, connect the relays and the temperature probe, and start Python. Yes, I can switch the relays on and off with Python, which means I have control of the freezer! Now, let’s go look at reading the temperature. Wait, what? No, it is not 127 degrees Centigrade inside my chest freezer… nor is it -127! Even after waiting for about 10 minutes for the thing to settle down, I get values ranging from 113 to 127 degrees centigrade – did I get the pullup resistor wrong? No, it’s the correct value, and all connections are good… ok, off to Google.

Back in 2007, it seems there was a run of bad chips inside the model temperature sensor I’m using – they would always report either 85 or 127 degrees centigrade, not the actual temperature. Yeah, that was bad, but supposedly those problems were fixed… except that I’m having the exact same problem in 2015. I’ve got to solve this – I can’t just turn the freezer on, it’ll drop down to -20 C and I won’t get any fermentation. Wait, I have an older model of the temperature sensor sitting in the aquarium that I’m now decommissioning… it’s part of that environmental sensor, so I know it works. I cannibalize it, and the two-year-old temperature sensor works like a charm, giving me a valid temperature reading inside the chest freezer. Whoo – managed to resolve everything just in time! It’s a damn good thing, too, since I’d already bought the 17.5 lbs of grain, the hops, and the yeast packets for tomorrow’s brew day!

So, the bottom line? Two parts – one, I no longer consider the Arduino project to be viable in any way, shape, or form. It has disintegrated into childish name-calling, and is suffering from severe bitrot. Two, the elecrtonics component manufacturers have forsaken quality control recently, and it’s pure luck if you get a new sensor (of whatever type) that actually works as advertized. Thank Fate for the Raspberry Pi and my ability to improvise.