Sunday, December 29, 2013

Avahi works great with wifi - finally

One of the first things I do when I setup a new SD card for my Raspberry Pi is to make sure I can connect to it headlessly; this means setting up the SSH daemon to start automatically, configure it to boot to a command prompt (both of these can be done using raspi-config), change the computer name (as described here) and install and configure avahi (as noted on this page). Lately, I also install wifi - in the past, I had some problems doing this but I found that Adafruit's directions work very well, both with my new WiPi and the old wifi dongle I had. Also, on newer Raspbian installs, the gui tool works great - at some point I was even able to launch wpa_gui and configure the wifi in putty using Xming and X11 forwarding.

One thing that bothered me though was that after configuring wifi I was able to connect to my RasPi using raspberrypi.local but only at home; every time I brought my RasPi to work, I had to use the wired connection. I thought the main problem is the avahi configuration that somehow works on 192.168.x.x (at home) but not on 10.x.x.x (at work). I tried so many things without success that I gave up at some point. Until a few days ago when I realized what was happening: at work, the wired and wireless networks are on different IP subnets (if this is the right word - I am no network guru); so, I connected both my laptop and my RasPi to the same wireless network and this time I was able to connect to my Pi using the raspberrypi.local shortcut using only wifi. This was so awesome!

I am pretty sure everyone using a Raspberry Pi knows this by now but for me it was a huge revelation and success so I decided to publish this post, maybe it will help others as well.

Sunday, December 22, 2013

My CheerLight(s) small project

Last Friday I found out about CheerLights powered by ThingSpeak and thought it would be really cool to put my Arduino + Ethernet shield to some use. Looked around for a little bit and found some code here connecting an Arduino to ThingSpeak/Cheerlights channel and driving a GE Color Effect Lights. Modified the code a little bit to drive an RGB led, decorated a tiny tree I had around and here it is my Christmas project alive.

The latest code is on codebender and below are some photos. I know the code can be much nicer but it works pretty well so I will leave it as it is. While working on it I ran into some weird behavior: a lot of failures when connecting to ThingSpeak and other strange stuff - it turns out the problem was with the response variable getting too big so I am resetting it now after getting the status (at least I think this was the reason because it works now after making the changes when reading the response).

Enjoy!