Posts Tagged ‘AVR’


My magic AVR build script


Don’t get me wrong, I like make…  Hah! Yeah, right!

make has its place, no doubt, but small microcontroller projects not so much.  In my projects I like to just start coding, pulling in existing code where it makes sense.  Maintaining a makefile for that gets old really fast, and is massively overwrought compared to the requirements.

So, over the last couple years I’ve developed my own scripts to build AVR projects.  The latest variation has just received a major speedup, so I thought I’d share it along with some selected Bash tips.

Read the rest of this entry ?


Mental excercise: tiny acceleration logger


When watching shows like Mythbusters, Prototype This, and Smash Lab, you regularly see them using accelerometers in order to test the shock characteristics of a given event.  The problem is that these loggers are invariably big (roughly 6″ cube by volume) and fraught with problems such as “triggered, hurry up before we run out of log space!”.  Given the current crop of really tiny accelerometer chips (such as the Freescale MMA4755 mentioned on dorkbotpdx, for $2 quantity 1), microcontrollers, flash memory and batteries, it seems almost criminal that they aren’t using something radically smaller and smarter.

So just for fun, I decided to toss some parts together and see if they would actually fit on an incredibly tiny package.  The design is not complete, as it is missing any charging capability and more importantly a Bluetooth uplink module, but it’s a good start:

I call it “rev -1″ because of the missing features, but it’s a good start.  However, it’s a whopping 1.125″ x 0.5”, sized to match a tiny LiPoly cell from Sparkfun.  It’s got an ATmega48 core, MMA4755 accelerometer capable of up to +-8G, and an 8Mbit dataflash capable of roughly 15 minutes of continuous recording at the maximum 250Hz sampling rate.  A tact switch is used to turn it on etc, and an LED just under that for status.

The next steps would be to add the Bluetooth module (e.g. this one also from Sparkfun), some kind of charging circuit, and possibly a USB-A connector to make it into a “USB key” for both data extraction and recharging.  I’d drop the huge battery connector in favor of soldering it on, and put the Bluetooth (and maybe some other parts) on the opposite side of the board, but I still think it’d fit.  I’d want to find a solid power-management chip designed to handle USB input and LiPoly charging that’s also insanely tiny, but these days the manufacturers are so keyed in on making multifunction chips in stupidly-small packages that it’s probably going to be harder to find one big enough to do on the group-order design rules.

Total retail price on this module would likely be in the $75-100 apiece, but the combination of size and potential feature set should be hard to beat.


RS-485 speed test rig


I just got started on a project all of the sudden that pretty much begins and ends at the speed I can squeeze out of various pieces of wire via RS-485.  To find out, I rigged up 2 Atmega48’s each with SN75176 RS-485 transceivers.  I happened to have those lying around (ok, stuck to various boards) because they ‘re what I use for DMX-512…

I had to start out by coercing a software UART into working, since the hardware UART is needed for the actual test channel.  The current challenge is to get the driver and repeater code to behave in the right sequence so I can actually start doing bulk testing at higher bit rates.  The obnoxious part is having to move around the AVR-ISP header.  My logic helper will fix that problem eventually, as I can just run 2 of the 8 ports to the AVRs, another couple as software-UART readout so I can watch both debug ports at once, and voila.

RS485 test