Monday, April 23, 2012

Arudino: Realistic Flickering Flame Effect

Mike from London posted a project on Instructables involving LED's and an Arduino, along with the required code to get the project to flicker like a flame. It looked simple enough to try as a good next project after going through the Spark Fun experiments and it turned out to work very well.

Mike from London's video on how he accomplished his flicker effect with an Arduino.

I used "Circuit 02" from the Spark Fun kit which uses 8 LED's - while the Instructable project used only 3. I adapted the code* to accommodate the extra LED's and it worked perfectly. Next I constructed a prototype shade to diffuse the light using a piece of paper, reflective material taken from a drink box, and some metal wire to form the top of the shade. Luckily, the wires and resisters hold the shade in place at its base perfectly - at least as perfectly as you'd want in a prototype.

The next step is to develop a process to make Arduino experiments into finished products - fully functional, permanent prototypes. Of course, unless it was absolutely necessary, you wouldn't want to encase your Arduino into a finished product unless it was something like a robot or large automated system. In the case of an electric candle light, it would be practical to use a smaller and much cheaper microcontroller. Make Magazine recently did a video and article where they explained the process of using an Arduino and its development environment to program an ATtiny45 or 85 chip - this was in turn based on an MIT tutorial which can be found here

This  Make Magazine video is quite interesting and I thought I would include it here. The number of pins might limit my design down to a certain number of LED's - this all remains to be seen.

I've chosen a coconut to serve as my light fixture - they are omnipresent in Thailand, sturdy, interesting to look at, and easy to work with. Until I can source an ATtiny chip and do a test run on a breadboard, I'll just have to settle with this conceptualization I did in SketchUp to show readers where this project will go next.

A conceptualization of the next step. The base used for the ATtiny chip will be a coconut, though the shade and other features to best distribute the light have yet to be determined. Luckily coconuts are a dime a dozen in Thailand and experimenting with different designs will be very easy to do.

Here's what the prototype looked like after adapting the Instructable's design by Mike (Earthshine) to use 8 inline LED's and a paper shade. The flickering effect is very subtle which is exactly why it is so effective. It actually looks like the light cast by a flame - not blinking lights.
While this project is not very advanced - it is the process of prototyping and developing an idea with an Arduino and then adapting it to a more permanent platform for everyday use. The lessons learned here can then be used for other, more advanced projects in the future.

****

* Here is the code I used with the SparkFun Circuit02 setup:

// LED Fire Effect

int ledPin1 = 6;
int ledPin2 = 7;
int ledPin3 = 8;
int ledPin4 = 9;
int ledPin5 = 2;
int ledPin6 = 3;
int ledPin7 = 4;
int ledPin8 = 5;

void setup()
{
pinMode(ledPin1, OUTPUT);
pinMode(ledPin2, OUTPUT);
pinMode(ledPin3, OUTPUT);
}

void loop() {
analogWrite(ledPin1, random(120)+135);
analogWrite(ledPin2, random(120)+135);
analogWrite(ledPin3, random(120)+135);
analogWrite(ledPin4, random(120)+135);
analogWrite(ledPin5, random(120)+135);
analogWrite(ledPin6, random(120)+135);
analogWrite(ledPin7, random(120)+135);
analogWrite(ledPin8, random(120)+135);
delay(random(100));
}

Saturday, March 17, 2012

Geek Group: A Premier HackerSpace

MARCH 18, 2012 ( SCI-TECH NEWS) There is a vast array of hacker spaces around the globe and many have made unique contributions to the emerging open source paradigm. However, there is one above all others, which is prolific not only locally but online as well - the Geek Group located in Grand Rapids, Michigan.

Perhaps the best explanation as to what the Geek Group does can be found on their YouTube channel in a new video titled, "Geek Group & Haas Partnership Announcement."



While the Geek Group has yet to create something as paradigm shifting as NYC Resistor's MakerBot, their educational videos have increased in both quality and utility - that is - amidst a major move and the ongoing  renovation of their Leonard Street location.

For those who have watched Geek Group's videos since before their move to their new location, they will certainly appreciate how far they've come. While visiting them, here in Thailand, poses a bit of a logistical problem, the torrent of videos they produce provide inspiration and assistance in emulating their model of providing a community center for teaching and exploring science and technology.

Wednesday, February 29, 2012

Arduino IDE on an EEEPC 701 Netbook

February 29, 2012 (PROJECTS & CONCEPTS) The Arduino is a simple-to-use microcontroller, which is essentially a programmable controller used to operate electronic projects. By measuring and regulating inputs and outputs, the Arduino can control lighting, motors, sound, and just about anything else electronic you can properly hook up to it. To give the Arduino instructions, you must write a program in the Arduino "Integrated Development Environment" (IDE) and upload it to the controller. This is generally done from your desktop or notebook computer.
An Asus EEEPC 701. This was the original model that started the netbook craze. Since then, Asus has come out with a whole line of EEEPC's including tablets and desktop versions. The 701 is still a convenient way to bring reading with you, browse the Internet, and now, with Ubuntu's Netbook 10.10 operating system, work on Arduino projects.
Luckily, even if you are a beginner in programming and you are unsure of what you are looking at - a lot of code is already freely available online to use with projects, and many times instructions are given as to how to tweak it to give different results. You need to have the IDE on your computer to work out the code and upload it to the Arduino - usually by a USB cable. If you are using Windows, you can simply download the IDE software, install it like a normal program and have it running in minutes.

If you have Linux, on the other hand, it can be a great deal more difficult - especially if you are like me and know very little about this open source operating system (OS). However, I have an Asus EEEPC netbook, a 701 model - the first model they came out with several years ago - and it came by default with Linux Xandros. I had long since replaced it with EEEbuntu (another Linux distribution) and it has worked flawlessly for years. But now I wanted another machine to run Arduino from, and since my main computers are generally rendering 3D around the clock on a very cluttered desk, I thought it would be handy to have my small EEEPC as a Arduino console to bring with me where I was working.

Installing Arduino on EEEbuntu is probably possible if you are an expert in Linux and using its terminal function. If you are a causal user, it is not. I then embarked on a three day odyssey searching for any OS that could both run Arduino's IDE and be installed on my EEEPC 701. I tried searching for different Linux Ubuntu distributions, both old and new, I even managed to get Andriod running for a day, but was rife with problems. I finally ended up with Ubuntu's Netbook version 10.10. I followed the instructions found on this beginner's guide on how to install the Arduino IDE on Ubuntu, and it finally worked.

The steps I took are as follows:

1. Download the utility Unetbootin on your computer (a Windows PC in my case). This allows you to download .iso files and put them on a blank USB thumbdrive. This USB drive can then be used to boot from on your EEEPC and install the OS of your choice - in my case, Unbutu 10.10 Netbook (download here: ubuntu-10.10-netbook-i386.iso

2. In Unetbootin, select Diskimage, keep it as ISO, and browse to your download folder and find the .iso file you just downloaded. Ensure that you have the correct drive for your USB selected because this process will erase any data you may have on another device or drive. When you are doing this sort of work - it is best to disconnect everything else just to be on the safe side. After clicking "OK" it will place the .iso image on your thumbdrive and when it is finished you simply close it (don't "reboot"), remove the drive and connect it to your EEEPC.

If you successfully hit your Esc key during your EEEPC's boot up, you should see this screen. If you have your USB thumbdrive with the Ubuntu .iso on it, it should show up as an option, usually the second one down. Pick it and hit enter.

3. Turn on your EEEPC and hit the Esc key at start up - a blue screen with boot options comes up (you might have to hit Esc several times until it comes up). You want to make sure you select your USB drive as the boot up device. If it works successfully, you will begin the self-guided process of installing Ubuntu. If a white line is blinking, you may have to shut it down, reformat your thumb drive, reinstall the .iso image, and start over (this happened to me many times when installing different OS' during the last 3 days).

4. Once you have Ubuntu up and running on your EEEPC, follow this fool-proof guide on installing Arduino's IDE. It worked for me the first time - and I am extremely inexperienced in all things Linux and not a computer expert by any stretch of the imagination.
My EEEPC running Ubuntu Netbook 10.10 with Arduino's IDE successfully running. The project to the left is the Sparkfun kit, circuit 14, the code for which can be found here. I was able to load a "fade" code example that is included with the IDE - and without changing anything to the circuit, the LED pulses on and off.

I was then able to upload to my Arduino successfully my programs and it worked flawlessly. If you try this and run into any problems contact us here at HackerSpaceTH at Gmail dot com. We will be glad to help, as I can personally attest, it can be very frustrating - but just remember, we hack not because it is easy, but precisely because it is satisfyingly challenging.