Saturday, October 23, 2010

Up and Running (Sort of): SmartClock

Happy Saturday Everyone,

I spent this morning working on the SmartClock; however as it turns out there might be more to it than I originally thought. In case you've just tuned in, the idea was to outfit a standard clock radio with a miniature motion sensor (specifically a Panasonic NaPiOn sensor) and a PIC microcontroller to shut off the LED display whenever the room the clock was in was empty.

Figure 1: Prototype controller (center), Panasonic NaPiOn motion sensor (top left)

The four-pin connector is for the anodes of the LED display, the three-pin connector in the middle goes to the motion sensor, and the six-pin connector on the left side of the board is dual-purpose: when the board is in the radio it acts as a power supply input, and when it's on the bench it acts as a ICSP port for the PIC programmer. As I was wiring this up I was thinking to myself "There's no way in hell I can ever let anyone see this", but here it is - the worst rat's nest of wire wrap I've ever seen:

Figure 2: Ahhhh!!! (well, I guess it is October - It's a Halloween project)


The Rats' Nest
First off: Don't ever wire anything like. Ever. In the top left we have two ST Microelectronic D10F10 N-Channel MOSFETS that control the anodes of the clocks' LED display. They are driven by the Toshiba TLP191B photocoupler (beige) in the bottom-center. The PIC12F629 is on the left side of the board (on the top side), and in the top-right we have the LM1086-3.3 LDO regulator. 

The Verdict
The idea was that by switching off the LED display when the room was vacant it would be possible to save a considerable amount of power over the clocks' lifetime (ballpark figures are found in the original post). After wiring this thing up and plugging in the radio I was disappointed to find out that the radio's current draw actually increases by about 1mA when the display shuts off. As this defies logic I will have to look into this some more, however it is obvious that in it's current state we aren't achieving the goal of power savings. 

Room for Improvement
- Better firmware (slower clock speed, sleep timers, etc)
- Better hardware (more efficient power regulator, lower power PIC)
- Less wire wrap

Though the idea of starting with a working clock radio seemed like a good idea at the time; in retrospect it would have probably been a better idea to start from scratch and build an entire clock from the ground up with power conservation in mind. Since the clock I'm using probably wasn't designed to be overly power conservative there are likely unnecessary losses in the power supply and the rest of the circuity already present in the clock.

Tuesday, October 19, 2010

Arduino Isn't A Country...

A terrible thing happened today:

I was cooking up some spaghetti for dinner; nothing too special. I was pouring the pasta sauce onto the finished masterpiece when I happened to glace at the lid for the jar of pasta sauce sitting on the stove.

My first thought: "Huh - There's a map of Arduino on this stuff"

delayMs(5000)

My second thought: "Wait! Arduino isn't a country! Italy is!"

delayMS(5000)

My third thought: "I wonder if I can hook the Arduino up to the stove to cook spaghetti for me..."



Technology is good. Life is Wonderful. Everything is terrific.

Sunday, October 17, 2010

Bluetooth Thermometer - Update!

'Morning Everyone,

I finally invested the hour-and-a-half and threw together a version of the Bluetooth thermometer on a small (45mm x 45mm) proto-board. Believe it or not it worked first time, which is quite amazing when you consider how much wire-wrap is hidden on the bottom side of the board.


On top you can see the Sure Bluetooth module on it's adapter board. It is attached to the base board by way of a 2.54mm female header receptacle, so I can easily pop it out and use it for something else should the need arise. The TO-92 device sticking out the side is the DS1820 1-Wire thermometer. It is attached to angled header pins so it too can be removed and extended if needed.

Hiding under the Bluetooth module is the PIC, 8.000Mhz crystal, some loading caps for the crystal (22pF), and 4.7k pull-up resistors for the /MCLR and 1-Wire bus pins on the PIC12F675. I didn't include an ICSP port was included for a reason - The PIC needs +5V to be programmed, and since the Bluetooth module runs off +3.3V it would probably end up getting fried if accidentally left plugged in while the PIC was being programmed. On the bottom of the board is an LM1086-3.3V LDO regulator, rated at 1.5A it is comically over sized for this application, but it's all I had lying around in my big box of miscellaneous parts, so that's what I used.





The Future
- Adding configuration features to the firmware (boot menu / options)
- Reducing power consumption (lower clock speed / better power regulation)
- Solar power supply and super capacitor (maybe not with this Bluetooth module though)

I do have a National Semiconductor LMX9838 Bluetooth Serial Port Module kicking around that I am hoping to use in lieu of the Sure module for the next iteration of this project. This would not only save PCB space, but also allow better software control and power management.

That's all for now folks - If you're interested in the firmware or hardware send post a comment and I'll make a conscious effort to draft up some schematics and cut-and-paste the firmware into the blag.

Right now I'm off to Future Shop to pick up a clock radio...

Saturday, October 16, 2010

Every Milliwatt Counts...

While everyone else was out on the town getting hosed and having a grand old time I was hold-up in my apartment diddling around circuits - surprised? Anyway, for quite some time I've been toying with the idea of integrating a Panasonic NaPiOn PIR Motion Sensor into a radio alarm clock to blank the display when nobody is home.

Now I realize that using this particular sensor is a bit impractical at $40 a piece; I certainly wouldn't have one if I hadn't procured it in the midst of a dumpster-dive, but I do believe that the idea does have merit, as clock radios do actually suck up a fair bit of power needlessly.

Panasonic NaPiOn PIR Sensor with a PIC12F629 Microcontroller

The Circuit
The NaPiOn sensor runs off +3.3V and outputs a logical "1" whenever it senses motion. Since the output only stays high for a second or two, we need something to keep the display on for a useful amount of time, and to provide a little bit of hysteresis to prevent rapid cycling, which would be annoying. The cheapest, easiest, smallest way to do this is with a microcontroller.

Could you do this with discrete logic? Sure. Could you do this with discrete logic for $1.30 and fit it into one square centimeter of PCB space? Not a chance. The use of a microcontroller also gives us the ability to change any parameter we want (time on, time off, etc) with a few lines of code.

Some Numbers
When you consider that the sensor draws about 60uA in standby, and the PIC could probably be made to draw as little as 20uA if the firmware were optimized, it is plausible that the whole sensing circuit could end up drawing less than 200uA including the power supply.


Some rough, ball-park calculations:

13mA Per Segment * 7 Segments * 4 Digits = 364mA (13mA per diode is a rough guess)

200uA = 0.2mA (this one is right)

This would mean that you could theoretically save a fair bit of power (relatively speaking).

Take my clock radio as an example. It's a Sony Dream Machine, and it's power rating is 12W. When compared to your 4500W clothes dryer, 12W is not very much, however we have to remember that clock radios generally run twenty-four hours a day, 365.25 days a year. So in effect:


12W x 24h x 365.25 = 105.192kWh/Year

(12W = 0.012kW)

As you can see, 12W happening all the time really does add up to a substantial amount at the end of the year. When you consider that most homes have more than one clock radio, and that they are only being "looked at" maybe 2% of the time they're powered on for, the potential for savings over the lifetime of the appliance does exist.

Tomorrow morning I'm planning on hacking open a clock radio, patching this circuit and taking down some real numbers. Stay tuned...

Thursday, October 14, 2010

Proffessional Selling?

Every now and then you see something you just can't pass up; and this was such an example. While waiting for Math class today I noticed this poster tacked up on a bulletin board outside the classroom:

Now I don't know the first thing about marketing, however I do know the following:

- Professionals use spell-check
- Marketing involves getting a message across clearly
- Professionals also use grammar and punctuation

Whenever I happen to catch a gem like this one I can usually contain myself, however this time I just had to go too far. Here is a transcription of my text-message conversation with the "Proffessional" trying to sell their book:

Me: "Hello - Are you still selling the book?"

Them: "Proffessional selling?"

Me: "Oh - You're actually selling a book called "Professional Selling". Sorry, your poster was ambiguous..."

Them: "What book do you need?"

Me: "Oh I'm in electrical engineering; I just thought your poster was funny, especially because you spelled "Professional" wrong and didn't use any punctuation. Sorry..."

Them: "Lol okay. Thanks for dis'ing me anyways.? Maybe you should become an English teacher?"

Me: "Professionals use spell-check. Especially professionals that sell things..."

Them: "Jesus. Thanks for the heads up"

Me: "Oh no problem - Your poster made my day!"

Them: "Surprised you had the time of day to text me just to say that!"

Me: "Some things are worth making time for. Anyway - best of luck selling your book..."


Alright - I know I'm a bad person and a complete asshole, but sometime you just have to be!

We don't use typewriters anymore! Both my browser and my cell phone have spell-check; there is no excuse for misspelling things in this day and age. Since whoever created this poster probably didn't use a printing press to duplicate it, the lack of punctuation is absurd! You don't have to pay per character - go ahead a use a period or colon: I dare you!

Alright. I'm done now. That's my rant about spelling and punctuation. Not only does it make you look like an idiot, it's just downright "Unproffessional"...

Wednesday, October 13, 2010

Right-Angle Circuitry?

I just happened upon this site through a link on Randall Munroe's (XKCD) "blag" this morning and thought I would pass it along; it is quite fascinating:

http://amasci.com/elect/mcoils.html

Tuesday, October 12, 2010

DatAzul - Universal Bluetooth Datalogging Platform

Happy Thanksgiving Everyone!


After spending a fair bit of time on the Bluetooth thermometer and power meter projects it occurred to me how great it would be to have a universal Bluetooth data collection and logging platform that anyone could use quickly and with few or no modifications. Here is what I was thinking of:

- PIC or AVR-based
- 3-10 Channels of A2D with programmable scales
- Flexible power supply options (AC wall wart, battery, solar, etc.)
- Simple terminal-based "task" configuration
- Complete usability through any terminal program, NO software on the PC-side except for a terminal program and a Bluetooth stack. This means that it could be used on any OS (Windows, Mac, Linux, etc) and with smartphones that support the Bluetooth COM object.
- Onboard SD/MMC card slot to allow the caching of data should the connection to the host be lost.

Just a few thoughts that have been bouncing around inside my head for the past could weeks. Maybe this weekend I'll have a chance to piece something together and a do a bit of testing. The biggest thing is probably going to be the "boot menu" through which you set up the device; I'm not really sure exactly how I'm going to code that, so if anyone has any suggestions it would be a big help.