Tuesday, August 16, 2016

Temperature Tracker

Description: A means of showing a graphic time plot of temperature readings from a DS18B20 digital temperature gauge.  This project is the original application of my bare-bones board, and I made it to track the temperature of my beer as it goes through active fermentation (spoiler: there was no change).

Detail: Rather than just display the current temperature, this shows how the temperature varies over time.  Each of the blue grid squares is 10x10 pixels, and each horizontal pixel represents one minute of time.  Each vertical pixel represents a degree.  The cyan line is at 32 (freezing).  Also captures all-time high and low temperature regardless of whether it's currently showing on the grid. Everything resets when power is cycled. 

Programming the grid and method of plotting from right to left was fairly tricky, but works really well.  The terminal block was an afterthought as it allows different DS18B20 sensors to be added depending on the application.  I have a waterproof sensor for the beer.  The sensor shown is just for ambient air. 
Bare-Bones board, screen removed.

Screen on and showing data.



ESP8266 and ThingSpeak

What it is: the classic Internet of Things starter device, something that grabs temperature and humidity readings in my backyard every two minutes and uploads the data to a website over my home WiFi network.

Details: through a lot of trial and error (and lots of online research) I cracked the code of uploading an Arduino sketch to an ESP8266-01 board.  The sensor is a basic DHT-22 sensor and the data is uploaded to a channel on ThingSpeak.  The Google gauge at the top of this blog is an HTML/CSS/JavaScript visualization object that draws the latest temperature from this channel.



As usual, I started with everything on a breadboard, then built a prototype board (now at my dad's house in Sonora, CA uploading to the Adafruit.io site).  Once I got the design nailed down I made a dedicated printed circuit board.  I like my completed projects relatively tidy and able to be packaged.

Tuesday, March 15, 2016

The Bare Bones...

Description:
A 50mm x 50mm printed circuit board designed to be a bare-bones Arduino board based around the Atmel ATMega 328P-PU.  On the left side are all components required to power and regulate the chip.  On the right side is a small prototyping area with Ground and Vcc rails.  Pins for accommodating a TFT display are along the top.

Details:
Perhaps it's a rite of passage, but everyone who fiddles with Arduinos eventually makes a bare-bones board (BBB), something that makes use of the input/output pins and capacity of the ATMega328 chip without the additional overhead that comes on an Arduino Uno board.  For multiple tinkering sessions with a breadboard, the Uno can't be beat... but after that's done you don't want to give up your Uno in the final application.  Plus, going this route lets you optimize power requirements a bit better.

So this is my BBB... I'll call it first-generation because I laid it out before getting my awesome new soldering station and learning how to lay down surface-mounted components.  It measures about 5cm square.  As before, I designed it using Fritzing and had it fabricated through SeeedStudio, so they cost about $2 each after shipping.


Features (going clockwise around the board):

  • Upper-left corner: +/- for direct battery connection if you want to hardwire a AA battery holder to this
  • Upper side middle: eleven holes to directly align with a 1.44" color TFT display (Adafruit #2088), but really all I've done is break out the usual SPI pins to make them accessible.  From left to right, the pins are: Blank, P4, P8, P9, P10, P11, P12, P13, Ground, Blank, Vcc.
  • A 6x14 prototype board area, with ground and Vcc rails on each side
  • Bottom center: three pins for a DS18B20 digital temp sensor and 4.7k resistor.  The signal from the temp sensor goes to P7 on the chip.
  • Left-side lower: 5 pins for a micro-USB breakout board (Adafruit #1833)
  • Left-side middle: space for an Infrared receiver diode in case you ever wanted this for a remote-control application
  • The open holes on the remaining pins are, well, open -- you just run jumpers over to the proto area.

Wednesday, March 9, 2016

The Slatherometer

Description:
This is a UV-B light sensor with output to a small OLED display, along with temperature and humidity readings, driven by an Arduino Micro board.  The purpose is to determine if sunblock should be applied based on the current UV index.  Instead of using batteries, it is powered by a single solar cell that charges two 10F ultracapacitors in series, yielding roughly 5 minutes of continual use.

Details:
It was a hot summer, with everything a kid would want: plenty of sun, swim lessons, biking, camping... and with all of that time outside, there was a lot of slathering of sunblock going on.  It's easily the worst part of a kid's outdoor adventure, and it's really no joy for the parents either.  So when Susanne's birthday came around, I wanted to make her life a little easier by making something that would tell her definitively if the boys needed sunblock.  Enter the Slatherometer.

The main sensor is a UV-B sensor purchased from Adafruit Technologies, and I followed a tutorial of theirs for the back-end programming to convert the voltage from the UV-B sensor to an actual UV index value from the Environmental Protection Agency.  I had an Arduino mini clone available, so I made that the backbone.  Rather than use the standard AA batteries, however, I had an opportunity to do something different... actually use the enemy (the sun) to power this thing.  Since it won't be operating for very long, I opted to use two 10F 2.7V ultracapacitors in series to store the power from a solar cell, and drive the output on a low-power OLED display (also from Adafruit).  No batteries to change, ever.  Nothing too good for my girl who wants to save the planet, and she's come to expect strange gifts like this from me.

The result is really quite handy, and from a completely dead set of capacitors it only needs to sit in the sun for about a minute to get enough charge to leave it on for about 5 minutes -- more than enough time.  The slide switch changes it from capacitor charge mode to discharge mode, and all you do is open the lid and point it toward the sun (the sensor is right next to the solar cell) and read the OLED display.  There's also a DHT-22 temperature/humidity sensor in there, because it would be interesting to know those.  

Classroom Snack Timer

Description:
This is a silent, light-based timer for use in a classroom setting.  The timer can be set through a 2-position DIP switch to either 1, 5, 10 or 50 minutes.  If left on, the timer will enter a power-down mode until power is cycled.

Details:
Both of my children were in a Montessori classroom in which students (Kindergarten through 2nd grade) have up to 15 minutes to have a mid-morning snack at a side table.  Their teacher, hoping to make this a self-policing activity, asked me to come up with a silent timer the students could use every day.  And the SnackTimer project was launched.

It needs to be small, easy to operate, somewhat robust, and can't make more work for the teacher.  The best solution is the simplest solution... so this is light-based, using the common green-yellow-red approach. Say you want a 15-minute timer. Turning it on, you see a solid green light that stays on for about 12 minutes, after which it gently pulses, indicating that the yellow light is about to turn on. The green light goes out and a solid yellow light comes on for about 3 minutes (for the snack table, this signals that the student should start packing up), ending with the same soft pulsing action. After that the big red light pulses indicating that their time is up (while the green & yellow lights face the student, the red light is on top so everyone can see the time's up).


Version 1:
The request came in on a Friday, and by Monday I had an initial working prototype in the classroom.  After setting everything up on the breadboard, I wrote the timing code and blinky-light action to make sure everything worked in theory.  Then it was a matter of soldering everything down, drilling holes in the empty Altoids tin, and putting it all together.  The teacher immediately used it and the kids loved it, so I made three more during the week for full-time use.


Version 2:
Over the next few months, every now and then a snack timer would come home in someone's backpack with a loose wire, a broken switch, or an LED pushed into the body.  It's easy enough to repair, but I started leaning toward making a dedicated printed circuit board.  At about $1.20 each (layout using Fritzing, and SeeedStudio for the fabrication), it really simplifies the work.  While I was at it, I decided to throw in a 2-position DIP switch in case the teacher wanted to use this for other than just 15 minutes.  Now it could be selectable for 1, 5, 10 or 15 minutes, and the light timing remains 80% green, 20% yellow.  Snazzy.  As old snacktimers came in, I just replaced the innards with the new board.


Version 3 (current version):
The teacher likes these so much that I was asked to sell them on Etsy.  For that, I went away from the Altoids tin and found a nice box on Mouser that would be clean, un-openable by curious students, and allow for a more robust on-off switch (the most common breakage was the mechanical slide switch).  While I was at it, I found a way to put the ATtiny85 chip into deep sleep mode in case someone leaves the timer on.  Ordered new printed circuit boards to make the wiring even easier, and took advantage of some surface-mount resistors.  I pushed these to the classroom and haven't had a single issue since.  In fact, the kids would argue who gets the white timer and who gets the old tin timers.  Design is solid!



Lessons learned:
1.  Get the prototype out in the field ASAP.
2.  Expect damage.  Receive feedback.  Respond.
3.  Look for improvements to make things smarter and implement at no extra effort to the user
4.  Make less work for the teacher.