Minimal cost arduino for your projects

Add to FacebookAdd to DiggAdd to Del.icio.usAdd to StumbleuponAdd to RedditAdd to BlinklistAdd to TwitterAdd to TechnoratiAdd to Yahoo BuzzAdd to Newsvine

Sometimes you don’t want to embed your $30 arduino board into your project because it is costly and too big. Sometimes you develop a project for small-scale production so you want to save every dollar. You could buy an arduino mini pro from sparkfun but it still costs you $19. Here is a way to save money and stay small.

Modern device has RBBB, or the really bare bone board. It is a board with ATMEGA328 chip on it so it runs your projects. But it costs less, only $15 per unit. You have to assemble it though. My minimal cost arduino start from there and only costs you about $8 each so you can feel free to duplicate 10 copies of your projects without breaking your bank. Here is how:

You will use the RBBB PCB only but buy parts from else where to save money. Here’s parts:

1. RBBB PCB from Modern Device $2.4 each (if you buy 5 boards)

2. 16MHz resonator from Modern Device $0.50 (if you buy 10 of them)

3. ATMEGA328 chip from sparkfun $4.3 each without bootloader but you can flash it in 2 minutes. Here is the one with bootloader.

4. Other parts from dipmicro $1.85 per complete set. You can use this manual to select the parts or just pick the following parts:

Music box

Add to FacebookAdd to DiggAdd to Del.icio.usAdd to StumbleuponAdd to RedditAdd to BlinklistAdd to TwitterAdd to TechnoratiAdd to Yahoo BuzzAdd to Newsvine

This is a project for a music box. It is not an ordinary music box as it doesn’t play songs but rather plays different musical tones when different sides of it faces up and gets a gentle tap.

Flip-n-shake/tap music box

You are given a well-decorated box, cube, with one musical note on each side,  flip it so that a desirable musical note faces up, shake or tap on the box, that note will play. When playing, the top side of box will glow with a certain color. Since there are 6 sides to a box, 6 notes can be associated with each side. I’ve built the prototype last weekend and managed to play a few simple songs by flipping and tapping on it. I am adding some video later this week. This box needs a lot of artistic touches in order to attract attentions. That is where I need some help. I hope to find some help at the Art Department. I imagine that when finished, two such boxes can be made so a person can pick them up with two hands and shake them to play as many as 12 notes. Many simple songs can be played with these two boxes.

Here is a demo:

This picture tells the inner working of the box prototype, an Arduino, a buzzer, and an accelerometer:

Please don’t mind the writings on the paper. I am looking for a house and I recycle/reuse paper 🙂

Stage 1: prototyping

The following is a video of the prototype. As you can see, the entire box is very ugly and needs a lot of artistic touch. I will post updates when I get more progress on it.

You have to crank your volume all the way up. I need a louder speaker and a lot of holes on the box!

Stage 2: adding light effects

Update: I’ve added some light effect and removed all the paper 🙂

You have to crank your volume all the way up. I need a louder speaker and a lot of holes on the box!

Stage 3: adding intelligence to the box

Now the box has a favorite tune. If you tap in the first 6 notes of this tune, the box will recognize it and plays the tune. In the future, I will purchase an MP3 shield to play high quality sound, like “Ah, that must have been my favorite tune, the XXX. I will play it for you”. Then it plays the tune in hi-def audio. I’ve removed the box top to make sure the sound volume is loud enough.

Stage 4: adding MP3-quality sound to the box

Check back later for this stage!


Stage 5: adding artistic touch to the box

Check back later for this stage!

Stage 6: adding lights to each side of the box

Check back later for this stage!

Stage 6: displaying the box in public place

Check back later for this stage!


Telling tilt orientation with accelerometer

Add to FacebookAdd to DiggAdd to Del.icio.usAdd to StumbleuponAdd to RedditAdd to BlinklistAdd to TwitterAdd to TechnoratiAdd to Yahoo BuzzAdd to Newsvine

Do you ever wonder how your cell phone or tablet knows when you have tilted it? They “have always” known which way is up and act accordingly. Even some cameras will rotate your pictures if you took it with the camera sideways. Well, let’s see what help they got.

In the not so distant past,one can tell orientation with a simple tilt sensor. If you have peeked inside of an old thermostat, you must have seen a springy coil and a glass container with shiny liquid inside it. The liquid is mercury.

Here is an awesome periodic table of elements: http://www.periodictable.com/index.html

Here is mercury: http://www.periodictable.com/Elements/080/index.html

Mercury is a metal and is in its liquid state under room temperature. It is a good conductor for electricity. Mercury is sealed inside of a glass tube. Metal contacts are brought inside of the tube. In the above picture, if you tilt the switch clockwise, mercury will flow to the right, making the two metal prongs connect, and a circuit will be closed (turn on the heat). If you tilt it counterclockwise enough, mercury will flow to the left end of the tube, breaking contact between the two metal prongs and opening the circuit (turn off the heat). If you mount this switch on top of a bi-metal metal coil, you will get a temperature control mechanism to control room temperature.

Another type of tilt sensor is a ball sealed inside of a tube. It is essentially the same as the mercury in a glass tube but is much safer now that people know how bad mercury is.

Some early products that had tilt sensing must have used these. The sensitivity is low and you need to debounce to get a reliable reading.

The tilting sensing capability that our current-day devices have come from accelerometers, micro-machined structures that respond to accelerations in general, gravitation in specific. Imagine a mass suspended below a spring. This is how we weight a product with a spring scale. The weight of an object is proportional to its mass and the spring will stretch proportional to force applied to it. We tell weight from how much stretch we see on the spring. Without the earth gravity, the mass will have zero weight, and won’t stretch the spring. If you take the spring scale and suddenly yank it upwards, the spring stretches even more than when it’s staying still with the mass. If you did the opposite, giving the spring a downward acceleration, the spring stretches less than when it’s still.

Using this mechanism and micro-machining, this spring and mass can be shrunk so much that it fits in a small chip less than the size of your finger tip. As many as three of these structures can be made together to give the chip 3-D sensing on its acceleration.

Here is an image of an accelerometer from sparkfun, which I used in a project. It is able to detect acceleration due to gravity.

When the accelerometer is staying statically, it senses the gravitational acceleration and its projection or components along the board’s x-y-z axes. You need basic vector concept to find out the angle of tilt from the components of acceleration measured by the accelerometer. The most basic information that one could get is, which side is up. Say if you read the accelerometer and your x acceleration is exactly one g, then x axis must be facing downwards, making -x direction facing upwards. The cell phones and tablets can then readjust their display to adapt the rotation.

I have started a project of a music box, which contains an accelerometer. You can tap on the box to play a tone that is written on the top of the box. You want another tone, turn the side of the box with that tone upward and tap, the box plays the tone. I have made a prototype last night and will explore ways to make it good looking and more responsive.

When the accelerometer is accelerating with the object that is attached to it, it measures the combined acceleration of the earth and the apparent motion. An application of this is the Nintendo Wii remote controller. One can swing the controller, shake it or else to swing a sword or else in a video game. You can also measure acceleration of an amusement park ride or a car taking a high way exit or racing on a race track. I plan to post a project that uses the accelerometer in explaining physics, in the near future.

Arduino and ATMega328 chip

If you are into Arduino projects, I bet you will eventually decide to “permanently” install your Arduino board with your project. It’s just $30 but still not that cheap. On the other hand, you can make a stand alone project without the Arduino board, just the chip on the Arduino board and a few other support components will get you the same functions as the Arduino development board. You then get your Arduino board back for your next project and save money with your completed project. Also if you destroy your Arduino while prototyping, sometimes, you only destroyed the ATMEGA328 chip, so replacing it will likely make your Arduino work again.

Unfortunately ATMEGA328 chips are on short supply. So if you see any store that have them in stock, grab a bunch because if you wait, someone else will snatch them up. This happened to me at least twice on sparkfun.com Last time I saw them in stock, I ordered 10 🙂

Make an enclosure or face plate for your arduino projects

Add to FacebookAdd to DiggAdd to Del.icio.usAdd to StumbleuponAdd to RedditAdd to BlinklistAdd to TwitterAdd to TechnoratiAdd to Yahoo BuzzAdd to Newsvine

So now you have completed a project. It is sitting inside an ulgy cardboard box with some holes poked by your screw driver but it’s still beautiful, maybe like this one I did sometime ago:

My project in a cardboard box

Not so good inside view with messy jumper wires

Since I didn’t know anything about printed circuit boards or PCB, I knew I had to solder wires together to make it more permanent, which scared me. I did have good soldering skills. I don’t ever have an iron yet. So I took a computer hard drive cable as means of connection to the LCD and taped on a tiny bread board on the front side of the box with buttons and wires, like a Frankenstein. Everything worked fine, just be careful not to pull out the wires.

I still have this box, to remind me how rudimentary my projects looked. Later I was learned how to design PCB, through several tutorials on sparkfun.com and other places, with the layout software EAGLE. With sweaty palms I submitted my design on batchPCB.com, an online PCB prototyping service that takes your design and make it, then ship the board back to you. It  charges $2.5 per square inch of the board plus shipping and handling. So it’s not very cheap but it did a decent job. After waiting about 3 weeks, I received my board that looks like this (I ordered one but received two for everything :):

Bare boards made at batchPCB.com

The PCB made soldering and assembly much better and worry free (no lose wires). An $8 basic soldering kit from radioshack will do just fine. So here is my assembled project:

Assembled project on PCB, powered up

Still this project looked naked. I wanted some cloths for it! I have spent many hours looking for a box that my project will fit in, with cutouts that will allow wires to come through and window for the LCD but with no avail.

Later I found out about 3-D printing. Amazing things happen if you mount a hot nozzle on a few motors and squzze molten plastic through it. You can simple print anything that you can design. I then spent hours to make a good design in 3-D, only to find out later that 3-D printing is simply too slow and expensive. I don’t even know anyone that has such a printer. I scraped it. But here it is, just never stepped out of my computer screen:

3-D model I made for my project

Even later, while asking for suggestions on the arduino forum, I was told that I could make top and bottom acrylic plates to partially enclose my project. Aha! So I quickly installed a very old edition of CorelDraw and designed a couple of plates for my project. I also found an online service, ponoko.com, which does custom designs with various materials from wood, plastic, to metals. I sent in my design and in about 3 weeks I received this:

Parts for my project box and more

Well after some assembly with standoffs, screws and nuts, here it is, a nicely wrapped project in its beautiful and transparent (yeah!) case:

“Complete” project with PCB and acrylic plates

Everything looked very nice and I showed it off quite a few times online and offline. But this is not the end of it, as I have eventually bored myself looking at a half-naked project. I don’t want water spills or other mishaps so I have to move up my packaging once more. If you want to know what happened to this project, or what it does, come back later and I will post some more. It only looks much better now:)

Alright, here it is:

The case was purchased from Allied Electronics.

Read the next post for more information including links to the case and other parts:

https://liudresllc.com/2011/12/10/enclosing-your-project-the-pursuit-continues/

GPS tracking – trip to the Cities



Add to FacebookAdd to DiggAdd to Del.icio.usAdd to StumbleuponAdd to RedditAdd to BlinklistAdd to TwitterAdd to TechnoratiAdd to Yahoo BuzzAdd to Newsvine

To further test my Phi-1 shield‘s capability to track and store GPS information, I used the GPS logger program that I wrote during a trip to the Cities. Here is a map that I made with gps visualizer:

 

If I zoom into the details, I can see the coordinates match relatively well with google map, except for places that I highlighted in the inset on the bottom right. The big bend that I drove through, with an inset on the top right, seems ok but not for the other big bend. Plus, the logger recorded about 600 points, with the first few as zeros. I will have to find out why it’s recording zeros. Plus, there is one time the same coordinates were recorded 4 times. Have to find out what’s causing this, the TinyGPS library or my code. I also tried to calculate the speed and compare with the GPS speed. The results are not very accurate, sometime off by 30%.

Here is what I used as an estimate: SQRT((Lat change)^2+ (Long change)^2)/(time change)*1.11

The 1.11 accounts for the factor between 10 micro degrees and 1 meter. From the radius of the earth, 6370Km, and the 360 degrees of latitudes or longitude. I think I have made a mistake on the latitude. Will derive an accurate formula later though. But overall I’m alright with my GPS logger. I will hopefully have more time to add more display functions to it so I can read all information from the GPS, including speed, time, altitude, etc. while it records. Right now it only displays Lat/Long as it records.

Program a standalone arduino

Add to FacebookAdd to DiggAdd to Del.icio.usAdd to StumbleuponAdd to RedditAdd to BlinklistAdd to TwitterAdd to TechnoratiAdd to Yahoo BuzzAdd to Newsvine

Occasionally I get this question from the arduino forum: “How do I program a stand-alone arduino? (atmega328 chip with arduino bootloader)”. I have a few ways to do this:

1) Buy a USB-TTL converter and make sure your standalone has headers on GND/5V/Tx/Rx/Reset. Use the adapter to program or communicate with the standalone. This will cost you anywhere between $6 and $20, depending on where you get your adapter and whether it automatically resets the arduino for programming. If it doesn’t, you need to hit upload, then once the bytes information is displayed in Arduino IDE, hit the reset on the standalone to receive programming. The following one is sold at sparkfun.com for $15.

2) This option is free. Use an arduino board, remove its atmega328 chip. Then also make sure your standalone has headers on GND/5V/Tx/Rx/Reset. Then use jumper wires to connect the arduino board to your standalone and you’re good to go. You will have to have an arduino board all the time.

3) If neither 1 or 2 apply to you, say you don’t have headers on GND/5V/Tx/Rx/Reset but your standalone is sitting inside a socket. Remove the standalone chip and insert it into an arduino board to program. This is ideal if you want to program a bunch of chips before you start. It will be benefitial to have a ZIF socket. You can effortlessly mount and unmount the chips.

Generate character LCD images for illustration

Add to FacebookAdd to DiggAdd to Del.icio.usAdd to StumbleuponAdd to RedditAdd to BlinklistAdd to TwitterAdd to TechnoratiAdd to Yahoo BuzzAdd to Newsvine

The above are definitely not pictures I took on my LCD but look just like one, only much better. How did I make them? I have recently made a Phi-1 shield with 16X2 character LCD on it. Here is a way I found to generate perfect character LCD images for manuals. How did I make them? I used Word.

First install the Ericsson font from dafont lcd font page 7: http://www.dafont.com/theme.php?cat=302&page=7

Then in Word, type the message you want, and pad with enough characters so both lines are 16 characters. Say if you want “Read data list”, you want to type “Read data listaa”. Then select everything, then use green high lighter. Then choose the padding “aa”, use the same green as the font color so they will be invisible and all you see is “Read data list [2 spaces]”. Tada!

Here is more illustration: