Ed_B's blog

The so-far-unnamed-project is moving forward. See here and here and here for the rest of the story. The time of day clock now prints onto a serial-input Vaccum Flourescent Display. The clock has up to 60 alarms. All of the alarms fire off a function called runTask(). In the previous version of the code, each alarm task could be tied to a uinque function call. It turns out that the  so-far-unnamed-project only needs one task. The alarm setpoints are held in a header file, also called an include file, which will probably be generated by a Processing app when the arduino stuff is done. The runTask() function requires an array containing about 2000 pwm values. These values live in a header file called performanceData.h. I was very surprised to learn that a user's .h files could not be included at the top of the arduino sketch. It's a long saga, but in short, it's an IDE bug. I wound up making an arduino library to get around the problem. In a library, the .h with the same name as the library, can referece other .h files included by the user. There seem to be programming issues with what you can put in the files (why?), but constant variables will work. The constant arrays are stored in program memory using the PROGMEM macro. This avoids chewing up all the RAM and crashing the AVR chip.


I'm still working on the unnamed project. It involves low power operation. The story is moving forward on different fronts simultaneously. Previously I looked at power consumption issues on a running ATMega168/ ATMega328 configuered as Arduino Lilypads. Significant issues turned out to be floating pins and the Power Reduction Register (PRR). To adjust the processor speed and clock source, I had to get comfortable with changing the fuse settings in the AVR. The next piece of the puzzle is setting up sleep mode. Sleep involves going to sleep and waking up, and also knowing what time it is when the MCU wakes up. The ATMega provides a higly accurate (moreso than the normal 16 MHz crystal) super low power clock using a special feature of TIMER2. TIMER2 can generate its own clock, separate from the normal system clock. It uses external watch crystal crystal connected to the TOSC1 and TOSC2 pins. Because this clock is accessable only to TIMER2, it can run while the rest of the AVR is asleep. If TIMER2 is configued to generate a periodic interrupt (there's more than one configuration that will work) that interrupt will wake up the AVR. Whenever the work is done, a few magic lines of code in the program can be used to put the AVR back to sleep. The TIMER2 interrupt with the watch crystal can be used to generate accurate interrupts for any purpose, not just sleep.


Arduino at 5volts and 5.3mA, and a Surprise

Submitted by Ed_B on Fri, 02/04/2011 - 04:18

An ATmega168 Lilypad Arduino is the basis for a set of design experiments for a larger project. The larger project is not described here. Power consumption is an issue, so I set about trying strategies to reduce Arduino power consumption. As  basis of comparison, measurements were made based on settings that could be changed in a running program, not fuses or circuit adjustments. I set out to get three or four baseline numbers relating to clock speed and internal peripherals. There was a big surprise hiding under a rock: The Arduino-like circuit being tested had by default, active, open input lines that drastically increased the mcu power consumption. The open lines also caused the chip power consumption to fluctuate sporadically on its own, and the fluctuations became more extreme as I moved my hand around the board. It took me a while to notice the correlation between my hand position and the current draw on the mcu, but then the mystery was gone. This is a classic case of the old caveat about not leaving cmos input pins floating -- tie 'em high, or tie 'em low, but don't leave 'em open. In the MCU, two things will fix this in software: set the pin to output, or leave it as input and turn on its internal pullup resistor. 


My current project (not described here) requires adjusting the clock system fuse settings in some arduino '168 and '328 chips. It turns out that there are a couple of things that can go wrong if you burn the wrong clock or SPI (serial) fuses. My pile of "bricked" MCU's was begining to look silly, so I did two things. First I figured out how to un-brick most of the bad ones. Second, I made a thorough study of the fuse settings in the ATmega48/88/168/328 datasheets and the Arduino documentation, particularly the boards.txt file. This text is pasted in from my project's working notes.


Erase bricked chip and reprogram.

Use an Evil board with no xtal or caps, 10K pullup on RST, and a
1MHz external clock oscillator module connected to pin 9.

I'd been trying lots of potential fixes that looked something like this, but
this is the one that finally worked. The differences are the "B"  [bitrate?]
switch set to 3 for a high speed spi clock, and no "-v" switches on the command
line. Avrdude may have  a bug relating to the -v switch.

commandline fu from http://forum.pololu.com/viewtopic.php?t=2122

varmint@Ktootoo:~$ avrdude -B 3 -c avrispmkii -p m168 -P usb -e

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e9406

avrdude: erasing chip

avrdude: safemode: Fuses OK

avrdude done.  Thank you.



From time to time, I'll be doing "retro" posts of projects and interesting things from my collecton of files. To start things off, here's a couple of pages on a 3 axis robot arm I made with a BUNCH of help. The page is a re-write of another page I put up in 2003. Humerus Labor (the name of the robot) has two pages. One is about the robot, and the other is about how it was constructed.

Robotic Art sometimes resembles traditional robots (arms or vehicles). Sometimes robotic art could also be called mechatronic art. Sometimes it's just kinetic work. Motion control works the same way and is made of the same systems no matter how it's used. Humerus Labor shows what motion control looks like in a very traditional way: A robot arm.

Four Channel LED Driver

Submitted by Ed_B on Mon, 11/22/2010 - 00:00

Here's a purely practical project I've done for student use in my department at SAIC. It's a breakout board for the Recom RCD-24-X series of constant current LED drivers. An LED driver's output current must match exactly the requirements of a given LED. Recom makes quite a variety of these modules.


In the Recom part number, X is replaced by the reguated current value. The board shown has one 1-amp and three 350mA modules.  I've noticed that 350mA is a common value for power LED supply current. The retail price for the Recom moules is about $12 to $15, depending on the output. (Click READ MORE to see the whole post.)


"Radio Hat" - Wearable Electronics from 1949

Submitted by Ed_B on Sat, 11/20/2010 - 14:25

Making /Hacking/DIY, 1949 style. This image was found at  http://www.swtpc.com/mholley/RadioElectronics/Jun1949/RE_Jun1949.htm The image is in the public domain. Yes, it really is a working vacuum tube radio. All the parts are fuctional.

Yes, it really is a vacuum tube radio.

Thyratron under load

Submitted by Ed_B on Thu, 10/21/2010 - 22:38

A thyratron is a type of electron tube used for controlling large amounts of AC power in motor drives and simlar applications. I have a small collection of thyratrons. This one is medium size. It can switch up to about 1000 volts and about 1.5 amps.  The load it's carrying is a 40 watt 120 volt light bulb (out of the image frame). (Click READ MORE to see the whole post.)

Simple Subversion: status, add, delete, and commit

Submitted by Ed_B on Thu, 10/07/2010 - 14:39

I'm using Subversion on google code for writing "timer-scheduler", an Arduino library.  (http://code.google.com/p/timer-scheduler/)  It turns out that the everyday commands are add, delete, status, and commit. I use them on the command line. Here's how they work for me.

Warning: It is important to understand that Subversion manages the local svn folders as well as the ones on the svn server. In particular, all file/folder deleting operations on the local folder must be done with the "svn delete" command. You can add folders locally, and then use "svn add" to add them to the Subversion project. But you cannot delete local folders and then "commit" (See "Deleting" Below.)

click READ MORE to see the whole post



Submitted by Ed_B on Mon, 08/30/2010 - 16:12

click READ MORE to see the whole post

timerInterrupt_Overflow.pde Copyright (c) 2010 Ed Bennett <ed@kineticsandelectron ics.com>

A simple demo of using the Timer2 overflow to generate interrupts in an Arduino.
Measured output is a sqaure wave of period 8.2mS. Note: A complete, technical explanation of an
AVR timer setup is in the posting on timerInterrupt_Match.pde Refer to that for more detail. Setup
for Timer0 should be nearly identical to implement.

Syndicate content