Tag Archives

12 Articles

Hangmanduino Update

I tried compiling Hangmanduino (see original post here) again using v 0021 of the Arduino IDE and found out quickly that things had changed. So I began troubleshooting and found that the WString library I was using was obsolete in the new IDE. Long story short, I was able to make a few adjustments to the code and got it up and running. Get the new code here (no need to download any additional libraries).

Enjoy!

Arduino IDE Crashing on Windows 7 (64-bit)

Posted on

I just spent the last 3 days (on and off) troubleshooting why my Arduino IDE wouldn’t open properly on my Windows 7 64-bit machine. I thought I’d share the fix with the rest of the world as my Google searches returned nothing in the way of useful answers to my issue. For my issue, I’d click on arduino.exe and the splash screen would display, shortly afterwards, it would disappear along with the arduino.exe process that was running in the background. I had tried debugging the java launcher, that looked fine. I had checked permissions on the folder, flipped the compatability mode of the exe, you name it. In the end I needed to check the “disable visual themes” checkbox on the exe (see screenshot).

Full path to change this checkbox: C:path_to_arduinoarduino.exe > right-click >compatibility tab > check “disable visual themes”  (not a bad idea to check “Run as Administrator” while you’re in here) > OK

Hopefully this helps someone else out there as they desperately scour the interwebs for a solution to get back into the IDE.

arduino_exe_screen

Br-r-r-r-r-ing…It’s your Arduino

A recent comment by the009 got me thinking…I’ve been able to get Asterisk grab info about sensors connected to an ethernet-enabled Arduino, but how about the other way around? What if you could allow your Arduino to make outbound calls through your Asterisk system to make a make-shift alarm system, or over-powered doorbell? Well, wait no longer! Here’s how it works:

Asterisk: A php script lives on your Asterisk server (hosted up by apache) that, when it’s accessed, checks to make sure the client accessing it matches a pre-defined IP of your Arduino. If so, it creates a call file with the criteria that you configure to call a number of your choice and drops it in the Asterisk outgoing queue directory, triggering Asterisk to make a call. (I would highly suggest you only set this up on a server that doesn’t have port 80 open to the world!)

Arduino: The sketch code is easy…simply trigger a client connection to the Asterisk server when a button is pushed, motion sensor tripped, or ultra sonic range finder measures a particular distance (that part is up to you). As long as the Arduino’s IP matches the allowed IP configured in the php script, your phone should ring!

Make it happen:

  1. To get started, download the code and extract the files.
  2. Copy arduino-outboundcall.php into your web directory on your asterisk server.
  3. Next, add the lines from extensions_custom.conf (zip package) to /etc/asterisk/extensions_custom.conf
  4. Edit the variables at the top of arduino-outboundcall.php to match your configuration.
  5. Upload the sketch to your arduino, customizing to your configuration (of course!).
  6. Adapt it to your project!

Feel free to edit and manipulate this script to fit your needs, I just ask that you add a comment to this page explaining how you used it. Videos / pictures are always welcomed as well!

Hangmanduino

Posted on
Hangmanduino

Hangmanduino is complete! A word is selected at random from a list of 10 words. This could be set higher, but for demonstration purposes, it’s 10. The user scrolls through the alphabet to select a letter using the potentiometer on the front of the case. To select a letter, the user pushes down on the potentiometer. Schematics, pictures of the build and demo video can be found below…click here to download the source code, but keep in mind you will need to download the string library as well to compile this code.

hangmanduino_5 hangmanduino_4

Hangman prototype…

Posted on
Hangman prototype…

Hangman Prototype

A few months ago I was wrestling with getting my 16×2 parallel LCD to work with an Arduino for a few hours, until I decided it had to be broken. All I was getting was garbled characters and solid blocks. A few months later, I picked it back up and did some more playing, and eventually got it working. Now to learn how to print custom characters to it…I learn by doing, so I decided to make a hangman program. Below are pictures of the perf-board rendition of a shield for connecting the LCD, a few potentiometers, a tactile switch and a speaker for noise-making fun. At this point the code works well, but I’ve got some ideas for improvement and a box is in the making. Perhaps I’ll even submit it to Brico Geek “Let Arduino Play” contest : )

Arduino Web-based Live Gauges

Posted on
Arduino Web-based Live Gauges

I needed some web-based gauges for my ArduinOil project frontend and I wanted them to be driven from PHP if possible. I came across Flash Open Gauges (FOG) written by Charles Nichols, which looked really slick and gave plenty of options as to the style of gauge and the methods that you feed it data. I started playing around with the scripts to customize them for my purposes. As I was learning about the feature of dynamically feeding the gauges data via PHP, I started thinking about how easy it would be to make the gauges live. A little tinkering, and voila! This won’t be particularly helpful in any of the projects I have going on at the moment, but I thought it might help someone else, so here’s how you’d make it work:

  1. You will need and Arduino (duh!), Ethernet Sheild, and some type of analog input device (potentiometer, photoresistor, etc).
  2. Go get the FOG files here.
  3. Download the demo scripts and sketch files I’ve created here.
  4. Extract the FOG into a folder on your server (can be either Windows or Linux, but must have PHP installed).
  5. Extract the demo scripts into the same folder as the FOG code on your web server and change the configurable variables in arduino_fetch_data.php to reflect the IP of your Arduino.
  6. Change the sketch code to reflect the IP you’d like your Arduino to have, upload the sketch and connect something to analog pin 5.
  7. Open the index.html in a browser by navigating to your server’s address.
  8. Read the FOG documentation and hack the scripts to do what you want!

I recorded a quick demo this morning of the script in action which you can find below. Also, keep in mind that I just threw this together on a side trail to a larger project that I’m currently working on, so there may be some refining that should be done to the code. I just don’t want to spend the time on it now, but if you need this functionality, it might be worth your while to poke at the code and try to improve it. Have fun!

ArduinOil update…

Posted on

It has been a few months, and I’ve had a few other projects come and go in the meantime. However, I’ve always had this project in the back of my mind. Not too long ago, I had a much better design idea for detecting the amount of oil in the tank. At first, I was trying to read the meter that is already on the tank, but the results were less than perfect and the hardware was going to be a major PIA to mount and maintain. One day I caught a video of a guy that made an automatic water dispenser for his cat or something crazy like that. But the thing I noticed was he was using a Parallax PING sensor to detect the amount of water in the bowl…enter proverbial light bulb. So I ordered one (a PING sensor) and started playing around with it. The results were amazing…not only is it amazingly simple on the hardware end, but the responses were more accurate and the code implementation was simple too.

Now that we have the data, we have to find some place to store it. I signed up for a BETA account at www.pachube.com and had a lot of fun programming the Arduino to speak pachube. I even got fancy with some Asterisk code to report pachube information via the telephone. But at the end of the day, there was still something missing…history. I really wanted to be able to look back on my fuel usage and get some trending information for curiosity’s sake…and I could not get such functionality from Pachube. So I did what any self-respecting nerd would do…I wrote my own. Here is the way it works:

The Arduino is listening on port 23 (telnet) for traffic. A cron job runs a script on the hour from a server that connects to the Arduino and sends a “p” (for percentage…”i” would return inches), which prompts the Arduino to pulse the PING sensor 5 times, average and convert the value to a percent based on the total tank size. The Arduino returns this information to the script which records the value and a time/date stamp to a database. From here I have a script that checks the database once a day and alerts via email if the level gets too low…however, I can do any number of things with that information. I have yet to write a “front end” to the database to make the information viewable over HTTP, but that is definitely in the works as well.

My next order of business will be mounting the ArduinOil components in the tank / furnace room, and doing the final hardware prep. I’d post some pictures, but honestly, at this point it’s just a bunch of code and tanggled wires. Hang in there…more to come!

Using Asterisk to Control your Arduino

Posted on
Using Asterisk to Control your Arduino

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 (1.4.21.2), 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.

    1. Download source code
    2. Upload the attached sketch to your Arduino
    3. Copy the arduino_control.php file into your agi-bin (usually /var/lib/asterisk/agi-bin) and edit the configurable options to match your setup. Make sure you change the permissions on the file with “chown asterisk:asterisk arduino_control.php” and also make it executable with “chmod +x arduino_control.php”
    4. Edit your dial plan (I use freePBX so the file is /etc/asterisk/extensions_custom.conf, otherwise it would be /etc/asterisk/extensions.conf) to include the following lines (you can change the 999 to whatever extension you prefer to dial to get control of your arduino):

; Arduino Control
exten => 999,1,Answer
exten => 999,2,AGI(arduino_control.php)
exten => 999,3,Hangup

 

  1. Restart asterisk services with “amportal restart”
  2. Hack the code apart and make it do something awesome!

“It looks like a bomb”

Posted on
“It looks like a bomb”

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…

Arduinoil

Posted on
Arduinoil

Testing iR sensor configuration on proto board

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 emitters 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.