It seems like every other day I’ve been tinkering further with my Master Control Project. Since I last blobbed about it, there have been a number of revisions and modifications.
First, I ran into all kinds of crashy problems which I traced back to the String object class. What worked perfectly under the older Arduino IDE no longer worked properly under version 1.0 – specifically it appeared that String objects were gobbling up dynamic memory until there was a stack heap collision and it would sieze up till I rebooted it. Very frustrating.
So the solution was to rip all the Strings out and use fixed char arrays. It only took about an evening to rewrite all that, and the end result was a surprising 5kB savings in the final compiled sketch size.
Along with all that, I made some changes to how tweets were sent, streamlined the content, and cut it back to one status tweet per hour. I’m still having some problems with tweeting – the Arduino Twitter library sends tweets through a 3rd-party host and sometimes that is inaccessable or non-responsive, but I’ve made the tweet function non-blocking so if a tweet does fail it won’t jam up the rest of the works – nor will it hang while waiting for a response from the 3rd-party server.
Hardware wise, I have made some more changes. I moved the Chronodot off of the back of the GLCD and mounted it on the Mega Proto board. It didn’t make sense being on the GLCD since it has nothing to do with that, and being on the Proto board means it’s more self-contained. It also let me use the temperature sensor in the Chronodot to get a feel for the temperature of the MCP’s main Arduino board. Which led to…
The Arduino was running quite hot. It was consistently around 120°F which is almost too hot to touch. This is because it’s got a lot of stuff going on, drawing a fair bit of current. It draws too much to power it from the USB port, so I had a regulated 9vdc supply going into it. That however meant the linear regulator in the Mega was turning the extra 4v into heat, adding to the problem.
So I got a descrete efficient DC-DC converter and wired that to my desk’s dc supply (13vdc for ham radio gear). I modified the Mega so it would accept a regulated 5vdc source without any further adjustments, and that has allowed the board to run cooler – down to about 100°F. (Though the DC-DC converter isn’t exactly calibrated, it’s about 300mV high. Shouldn’t be a problem though.)
The newest hardware upgrade was the addition of an Adafruit Thermal receipt printer. The idea here is to be able to get hard-copy logging of things, and printing out messages. Right now there’s two things that get printed regularily – first, every time it sends a status tweet, it also prints the current radiation level along with a timestamp.
And second, based on the Adafruit Internet of Things Printer, it checks with Twitter and prints out any tweets that are addressed to it or to myself. Twice per hour it accesses the twitter search api then prints out any new tweets. (It is throttled so if there’s a lot of traffic, it won’t go crazy.)
One last software “upgrade” was that the Arduino sketch was getting rather large – it was pushing 2,000 lines, and it was getting harder to find specific lines when working on it. So I broke it apart into separate files, so similar functions and routines are grouped together. Hopefully it will make it easier to read, and easier to debug problems.
If you are interested, you can download the latest project files here:
The next major upgrade I have in mind is to add a second GLCD – two of them stacked vertically will give me 128×128 pixels of monochrome graphics. I’ll probably retire the character LCD as it won’t be necessary at that point.
Also, maybe some controls, finally. So I can, like, control it, and stuff.