Being an avid Asterisk admin and a novice AGI coder, I decided that it would be cool to try my hand at using Asterisk to control my Arduino over ethernet. Upon googling similar projects I came across Kate Hartman’s page on doing just that with an Arduino connected via an XPort module. Well, I have the Adafruit ethernet shield with a WIZnet module, but I decided to give it a try anyway. The first thing I noticed was the Arduino code appeared to be communicating with the XPort module via serial communication. This is a bit of a problem as the WIZnet module needs to make use of the ethernet library in Arduino IDE. So I threw together a little test environment with an LED connected to pin 4 and plugged in my ethernet shield to give the code a shot. Needless to say, it didn’t work straight out of the box…so I’ve made a few minor modifications which you can find attached to this post. I also found that Kate’s Asterisk AGI code was a bit dusty, being written perhaps for an older version of Asterisk than what I have (188.8.131.52), so I made a few modifications and was able to get it up and running. This should come in REALLY handy for some of the projects I’ve got waiting in the wings (ArduinOIL). Here’s how to get it up and running.
; Arduino Control
exten => 999,1,Answer
exten => 999,2,AGI(arduino_control.php)
exten => 999,3,Hangup
A month ago, my younger brother-in-law asked me to help him with a science project that would get him some serious extra credit (over achievers!). The assignment was to create a working seismometer. Sounds like a job for the almighty Arduino, doesn’t it?! We asked the teacher and she answered with an enthusiastic “YES!” I thought it would be a good opportunity to introduce him into the world of electronics and maybe even peak his interest…so I ordered the parts and last night, we started to build.
We finally had the breadboard / sketch code worked out, and started the physical mount/build process last night. Below is what we came up with…we call it “Seismoduino”. At present, there are 2 “modes”, meter mode and graph mode. In meter mode it takes the readings from the ADXL322 accelorometer and feeds them to our little array of LEDs which display the readings as a meter. In graph mode, the information is sent to the COM port and graphed by some Processing 1.0 code. We’re still working out the kinks and features, but should be finished soon. Once we’re ready there will be some more (better) pictures and even some video…
As with most projects, my most recent project was born out of an inconvenience, an an empty wallet, and an idea.
The inconvenience: walking outside in sub-zero temperatures to check my fuel oil gauge. I know it’s lame and I’m lazy, but there’s something annoying about not having the information at my finger tips (ie. the internet) no matter where I am.
The empty wallet: checking….yep…still empty.
The idea: to be able to read the information from my current oil gauge and feed it to a web-enabled service so I can not only check the current level, but have stats and trends available from anywhere in the world.
So far I have the general process all figured out. A series of infrared emittors and sensors will span the oil gauge “tube” and scan for the indicator. A server will periodically query my ethernet-enabled arduino to get the reading of all the sensors and return a percentage value. These value will then be stored in a MySQL database and processed accordingly with some PHP code.
At this point I’ve been able to get the sensors all wired up and tested. Everything seems to be working quite well. I received my ethernet shield last week and started playing with that. I’ve got a bit more tinkering to do with that before starting the build of the actual sensor enclosure. I’ll post updates as I progress.
I was thinking about buying a BoArduino for easier prototyping…it’s easy and cheap, but not as cheap as I am apparently. I decided to build my own instead using an old proto board, some pin headers and CAT5 cable I had laying around. It’s not nearly as pretty, but just as functional, and I don’t need to reload my code to the arduino I plan on using in “production” because I actually built it in shield format. I’m working on a prettier version, using that as a pet project for learning Eagle PCB layout. But for now, this works just fine.
Since I started in IT, I’ve always been a scavenger of sorts. Ripping out hard drives, memory, fans, coin cell batteries…you name it. But it wasn’t until I started building electronic circuits that my scavenging tendencies really started to run rampant. There are numerous electronic goldmines all around us, that if you’re willing to open your eyes and tap into these resources, you can save yourself a bundle of money, and sometimes even open up new ideas for projects or solutions to existing projects. One my most recent discoveries of one such goldmine can be found in public facilities everywhere: the automatic paper towel dispenser.
While at work, I was walking by a garbage can and noticed one of these dispensers. It almost screamed my name as I walked by, did a double-take, and stood there for a moment to think it over. With a quick look around I made sure no one was around, I snagged it and ran for my office. I hovered over the the dismantled appliance with an evil…OK, not really…but in about 5 minutes I did have myself a nice little collection of trinkets to play with. A short list of components: 5V DC motor with matched gears, 3 or 4 different types of switches, and momentary buttons, a proximity sensor (I haven’t quite figured out how it works yet), a few LEDs, and a board chock full of diodes, resistors, and other miscellaneous components (if you take the time to de-solder).
It is my understanding that these things are very easy to find in the dumpster because they are given out by the paper towel companies whenever a company orders of product are purchased. I guess their thought is, wherever there’s a paper towel dispenser, there’s bound to be paper towels. So the more they give out, the more product is sold. Also, most maintenance people don’t even bother changing the batteries, they just grab a new one from the back closet and throw the old one in the garbage.
OK, so what’s the take-home lesson? Keep your eyes open…one man’s garbage is another man’s robot. You never know what could be salvaged out of an old answering machine, TV, network switch, radio, or even paper towel dispenser. Oh ya, and please don’t go ripping these off the wall the next time you’re in your local 7-11…they’re actually kind of handy when they work. : )
I received my first Arduino in the mail the other day. Of course I went through all the tutorials and started tinkering right away. But I won’t bore you with those details…God knows there are too many “I plugged in an LED and got the Blink program running” out there already. But I did design a quick little circuit that I thought might be handy as a tutorial for beginners (like myself).
For the physical setup, all you need is an LED with a 220Ω resistor connected to pin 11, and a photocell connected to pin 2 with a 5V pulldown configuration (see pictures). I’ve attached the sketch code to the post…upload the sketch to your Arduino and say goodbye to the boogie monster. Click here to download sketch code.