Arduino-lite – A Lightweight Runtime for AVR

I just ran across Arduino-lite, a lightweight alternative runtime to Arduino, for programming AVR MCU’s.  This project is spearheaded by Robopeak Project.  It looks pretty cool.  It’s kind of halfway between Arduino, and coding directly with avr-gcc.  It supports the standard Arduinos, as well as:

  • Atmega8(A)
  • Atmega168(PA)
  • Atmega328(PA)
  • Atmega1280
  • Attiny2313
  • Attiny26
  • Atmega48(PA)
  • Atmega88(PA)

Not only does it support more MCU’s than Arduino, it also supports frequencies from 1-20MHz, unlike Arduino, which only supports 8 & 16MHz.

Furthermore, Robopeak claims that Arduino-lite’s binaries are 50% smaller than those produced by Arduino. An example on Robopeak’s Blog shows how Arduino-lite reduces the digitalWrite() function down to 1 AVR instruction.  It appears to make heavy use of macros, which is nice, because it eliminates function call overhead.  On the other hand, type checking and such is severely restricted.  I think it might be a great tool for projects that need to be compact, or run as fast as possible.  Also, it will greatly simplify coding for the ATtiny MCU’s.

It’s definitely not for n00bs, but if you’re comfortable with makefiles, give it a shot.  The download includes everything you need to get started.  You can download it for free from google code.

I just downloaded it, and am going to give it a whirl.  It almost sounds too good to be true.  If you have any experience with it, please leave a comment.

Download Arduino-lite: http://code.google.com/p/arduino-lite/

Relax Your Mind: Make Your Own Ganzfeld Goggles

The Ganzfeld effect is a form of visual sensory deprivation.  The idea is to give the open eyes a blank visual field of uniform color.  Since there is nothing for the eyes to see, the brain cuts off the unchanging input, and often manufactures its own images – these may be thought of as mild hallucinations.  Personally, I haven’t experienced any vivid hallucinations via a Ganzfield, but I find the effect to be rather relaxing.  I’ve found that a Ganzfeld is very good for helping to eliminate excess chatter in the mind, especially when practicing meditation.

One common meditation technique involves cracking the eyes just barely open, so that even though your eyes are open, you can’t really see anything.  There are two purposes for this technique: 1) it’s easier to stay awake with the eyes open and 2) when the eyes are closed, the brain goes into the idling alpha wave rhythm. When you meditate, one aim is to generate alpha with the eyes open; this isn’t easy, because in typical settings, there are too many distracting things for your eyes to see.  I find it easier to stay awake when I use Ganzfeld goggles than when I meditate with my eyes barely cracked open.

A common technique for creating a “Ganzfeld goggles” is to cut a ping pong ball in half, and then place one half over each eye. While this technique is cheap, and relatively easy, it’s not particular comfortable, as the edges of the cut halves tend to be sharp.  Also, they’re easily damaged.  I’ve devised alternate cheap and easy method of building Ganzfeld goggles, which is more comfortable and durable, and better than an expensive commercial alternative.

My take on Ganzfeld goggles starts with a pair of cheap swimming goggles.  I bought a pack of 3 at Big Lots for $7.

It’s important to use large goggles with a bubble lens as above.  What we are looking for is to have a big enough lens that when we’re wearing them, the edges are basically outside of the visual field.  Next, we need a can of frosting spray:

You can find glass frosting spray in the spray paint section of most hardware stores.  I also tried white paint, but frosting spray is better, because it lets more light through, and filters the light more evenly.  Remove the seals and straps from your goggles, and spray on the frosting

Be sure to spray both the outside and inside of the goggles.  2-3 coats are needed to achieve a sufficient frostiness.  Wait about 10 min between coats.  Once they’re dry, reassemble your goggles.

Your Ganzfeld goggles are now ready to use.

 

I won’t go into detail here on how to use Ganzfeld goggles, because you can find plenty of articles via Google.  However here are some basics:

Find a quiet room, and lay down in a recliner or on a bed.  Keep your eyes open, and relax.  You may want to try auditory sensory deprivation, as well.  Since it’s hard to find a completely quiet place, another way of decreasing auditory distractions is to listen to white, pink, or brown noise through sound-isolation headphones.  You can make noise files easily using Audacity, a free audio editor. Here is a tutorial on YouTube for how to generate white/pink/brown noise.  Although the video says you can use any version of Audacity, only Audacity 1.3+ can generate pink and brown noise.  Audacity 1.2.x can only generate white noise.

You can also try audio brainwave entrainment, using binaural beats.  Some people like alpha wave entrainment; personally, I find 7 Hz theta wave entrainment to work best.  There SBaGen and BWGen are two free programs for generating binaural beats.  An excellent commercial software, which is a lot more flexible, and can generate other waveforms, such as isochronic beats, is Neuroprogrammer.   STAY AWAY FROM I-DOSER. The author makes ridiculous, fraudulent claims, and the program is just a rip-off of Jim Peter’s GPL’ed SBaGen code.

If you want to use the goggles to enhance your meditation, simply wear them while practicing your normal meditation techniques.  Instead of keeping your eyes barely cracked open, you can keep them fully open, half open, or whatever way feels most comfortable.   Again, I won’t go into detail about meditation techniques, but a good method for beginners is Counting Meditation.  Sit with your spine straight and tailbone slightly elevated by a pillow. Inhale and exhale deeply and slowly through your diaphragm (you expand your belly, rather than your chest during breathing) while  counting your breaths.  As you relax, your breath will naturally slow down.  If you lose count due to being distracted, simply start over.  Eventually, you will be able to get the count higher and higher before you lose your concentration.

Another experiment you can try is to play with colored light sources.  For instance, you can sit in a room which is lit by a red lightbulb.  I’ve found that even sitting in the dark with some colored LED’s works.  If you want to attach the LED’s directly to your goggles, you can diffuse them with ping-pong balls.  Just cut a ping-pong ball in half.   Hot glue an LED into each one, pointing away from the opening.  Then hot glue the ping pong ball halves onto your goggles.

While I don’t experience hallucinations when using the goggles, they are quite relaxing, and really do enhance my meditation practice.  With the vision blocked, your brain shifts its attention more to your other senses.  If I use them without listening to my entrainment tracks, I become much more aware of the ringing in my ears that my brain normally filters out.

I’ve also played with an alternate pair, which I painted with several coats of black paint. The idea is to completely block out the light, so it’s like you’re sitting in a pitch black room of absolute darkness.

blkgoggles

I actually prefer this black pair when meditating. Your brain naturally produces occipital alpha waves when you close your eyes.  The idea of meditating with eyes open is that it forces you to produce the alpha waves by meditation only.  However, meditating with eyes open is visually distracting.  Wearing the black glasses allows you to eliminate visual distractions while meditating with eyes open.

 

Update 2014-12-18:

If you find swimming goggles to be uncomfortable, you can try using safety glasses. I bought a pair at my local 99 cent store. You can also find them cheaply at HarborFreight. Simply pop out the clear lens, spray with frosting spray, and then reassemble.

ganzglasses

I find the safety glasses to be a bit more comfortable for long sessions. The downside is that in order to avoid peripheral vision from ruining the ganzfeld, you have to wear them fairly close to your eyes, and avoid rolling your eyes up or down.

Mindmodifications.com has an interesting article about the Ganzfeld effect: MULTIMODAL GANZFELD GIVES MILD HALLUCINATIONS
They also have detailed instructions on how to build the goggles out of ping-pong balls, should you want to try that version, as well.

Enjoy your Ganzfeld goggles, and feel free to leave feedback about your experiences below, or to tell of any enhancements you devise.

Related Post: Build Ganzfeld-style Photic Goggles (AVS Lightframes)

How to Use the Arduino IDE with an External Programmer

If you have a hardware AVR programmer, such as the USBtinyISP, you can configure your Arduino IDE to use it for uploading sketches, rather than the standard USB interface.  Why would you want to do this?

  1. it uploads faster
  2. your project will boot faster
  3. you can load bigger sketches, because you don’t need the bootloader anymore.
  4. it’s a lot more convenient when debugging communications between a host computer and the Arduino’s serial port, because you don’t have to share the port with the Arduino IDE and take turns accessing it.
  5. you want to build a project which uses the Rx/Tx pins on the MCU, which conflicts with programming via serial.
  6. you can use it to program stripped down AVR boards, such as the $2.99 board pictured below:

 

Windows users only: First, you must install the device driver. Follow the instructions here: http://www.ladyada.net/make/usbtinyisp/drivers.html

 

First, open your Arduino/hardware/arduino/boards.txt file in a text editor, and add the following lines:

##############################################################

usbtiny328.name=[usbtinyisp]ATmega328

usbtiny328.upload.using=usbtinyisp
usbtiny328.upload.maximum_size=32768

usbtiny328.build.mcu=atmega328p
usbtiny328.build.f_cpu=16000000L
usbtiny328.build.core=arduino
usbtiny328.build.variant=standard

Note:  The …variant=standard line is only needed for Arduino 1.0+. Older versions of Arduino will just ignore it.

If you’re using a programmer other than a USBtinyISP, substitute its identifier where I’ve typed usbtinyisp above. You can see the options in your hardware/arduino/programmers.txt file. In arduino-0022, the options are avrisp, avrispmkii, usbtinyisp, and parallel (beware, it’s case sensitive, so for instance, you must type usbtinyisp, not USBtinyISP). To support a different MCU, substitute it in the usbtiny328.build.mcu= line, e.g. atmega168. If you want to support more than one programmer/MCU combination, just add multiple sections with the different configurations to your boards.txt file.

Next, hook up your programmer to the ICSP header on your board, and plug it into your computer. Select your new board configuration from the arduino Tools->Board menu:

Now, you can burn your sketch as usual, via the Upload button. Note that your bootloader will be overwritten, so you won’t be able to burn sketches to the same board without your programmer, unless you follow my instructions for restoring the bootloader below. On the other hand, after configuring your arduino software as described above, you can still burn sketches to arduinos which have the bootloader installed without your programmer. Simply pick the correct board from the Tools->Board menu.

———————————————————
Restoring the Bootloader

Once you’ve burned a sketch to an arduino via ICSP, the bootloader will be overwritten. If you want to revert to burning your sketch without a programmer, you must first restore the bootloader. With your programmer connected via ICSP, select Tools->Burn Bootloader:

Now, you can disconnect your programmer and hook your arduino directly to the computer via USB. From the Tools->Board menu, select your board:

Now, things are back to normal, and you can burn your sketch via the Upload button.

Build Your Own Daft Punk Table (5×5 LED Display)

Welcome my blog. This is my first post.

This is a 5×5 LED matrix display I built, using an ATmega368 microcontroller (arduino) and 25 warm white LED’s.  It was inspired by the Daft Punk coffee table, which is no longer sold.

I posted my first Instructable last Sunday.  It got selected by the editors to be Featured, which won me a free 3-month Pro membership.  I entered it into the Sparkfun Microcontroller Contest.  Today is the last day of voting.

http://www.instructables.com/id/Yet-Another-Daft-Punk-Coffee-TableDisplay/

I will be revising it and adding features, such as live music synchronization. I will post the developments on this blog as they happen, with detailed instructions.