Biobug.org

Projects, notes, etc by Will O’Brien

Entries


My WishList
Resume
Want My Coffee?

Production

Photo Gallery
Articles
Podcasting
News

Amusements

Audio
Brewing
Cigars
Coffee
GPS/GeoCaching
Hacks
Home Theater
Kayak
Machine Shop
Photography
Recipes
SCUBA Diving

Research

CNC
CAD
Scripts
VR Interface
Environment
KarKomp
KarKompV2
MythTV

Reference

OWLNet
Quit Soda
Mac
Linux
Tech Ref
Panasonic Toughbook
Dreamhost hosting

Communication

Blackberry
T-mobile MDA
Danger Sidekick
WRT54G(s)

Transport

Land Rover
4Runner
Beetle
Jeeps
Motorcycles
EV Motorcycle
About
Links
Search

Arduino sine wave with a digital potentiometer

21 September, 2009 (07:18) | Uncategorized

ard-digitalpot

Arduino, Digital POT and an o-scope probe

I wanted to create a sine wave to test my ignition system with a better test signal, but I didn’t have a DAC handy. I did have a spare digital pot from my RGB doorlock project. There are several examples of DACs being built from resistor ladders, so I figured I’d give it a shot. The SPI digital pot tutorial made this pretty easy to set up.

Rather nice sawtooth

Rather nice sawtooth

Here’s what I managed to produce, using some code that stepped the resistance on one of the digital pots. After increasing the slope of the output by sending steps of 5 (out of 255) I ended up with this sawtooth pattern. With a bit more code I can probably produce a fair sine wave with the pot, but ultimately frequency will be limited by the speed of the SPI interface. To perform my test, I need a frequency that equals RPM/(60sec/min) * 36 pulses/revolution. At 1200rpm, thats 720Hz or 1pulse every 1.39ms. When you add in the extra writes to smooth out the curve, the digital pot trick will probably get close, but it’ll be pretty difficult to simulate something faster like 8000RPM (4.8kHz or every .2ms)

«

  »