Monday, September 16, 2013

Unsuccessful: Wireless Arduino Mood Light Controller v4

Prologue: 
I started writing the below post about a year ago but in the end I never really found a solution to the problem and consequently I never finished the post. Sometime it's best to know when to quit, but maybe this project can be of use to you anyway. Or maybe you'll find the solution that I didn't... well if you do please let me know. 

Look Ma no wires!

Ok, so I've built an Arduino based Mood Light Controller and I've managed to get my Arduino to send integers over RF with VirtualWire. Finally I've also built my first Arduino Standalone ATmega / Arduino Bare.

Now I've combined the three into one Wireless Arduino Mood Light Controller. To be honest I had two very different projects planned for my Standalone ATmega and the RF part but those sort of became obsolete in my current living situation.


Original circuit drawn with www.circuitlab.com
Above circuit breadboarded on a protoshield.

A bug in the code?

When I first merged the RGB Mood Light code with the RF Receiver code my Arduino kept hanging. Confident in my own coding skills I quickly aimed my blame towards those who write librarys for the Arduino IDE. The good folks in the Arduino forum managed to deflate my swelling ego and pointed out a few flaws in my code before coming to the conclusion that it might be a hardware problem.

"The rise and fall of a ego" is available as a thread in the Arduino forum.

Meanwhile back on earth ...
I moved my question to the General Electronics part of the Arduino forum, this time with a little more humble attitude. After following the instructions of Grumpy_Mike I quickly learned that my problems came from interference caused by using PWM to control the RGB LED. The trick was to swap out the resistors to 1K Ohm resistors in order to minimize the current and the interference it caused. With 1K Ohm resistors everything worked flawless, well except for the LED that got quite dim.

To minimize the interference Grumpy_Mike suggested the use of capacitors and/or ferrite beads. This actually helped a bit but still not good enough.

Improved circuit with capacitors to stop interference caused by PWM.


Above circuit breadboarded on a protoshield.

Kind of messy and lot's of wires that can cause interference. 

Apparently the problem with a circuit like this is that every lead and wire is a source of interference.So I was advised to try to make the circuit tidier, shorten leads and hope for the best.

Leads of the LED and resistors trimmed down ... 

... and the RF receiver connected via a ferrite bead as well as an added physically distance. 

Also the power supplied to the RF receiver is decoupled with a capacitor. 

Dead end? 

Unfortunately all this helped very little... and I'm sort of stuck. If you do find a solution to this please let me know as I would love to finish this project.

Source code

Transmitter code
Receiver code

Please note: The above code is a work in progress and could change, stop working (worse than it already does) with out notice.


Wednesday, September 4, 2013

Upgrading from Squeeze to Wheezy using Cupt

I recently read about Cupt a rewritten apt-get replacement that apparently would be more suitable for low end machines. Well it's not specifically written for low end machines, I guess it's just less resource demanding.

Anyway I decided to try upgrading my old Toshiba 320CDS from Debian Squeeze to Wheezy using cupt. Upgrading in Cupt comes in a couple of different flavors. I decided to go with the one I know best:
sudo cupt update 
sudo cupt dist-upgrade 

Actually all things went fairly smooth  apart from conky breaking the upgrade halfway through. I resolved this minor issue by just removing conky (sudo cupt remove conky) when the upgrade broke and then just start the upgrade from scratch (or whatever state my system was left in).

When the upgrade was done, everything seemed to be ok, but at reboot I was dropped to busybox...(sigh) as usual. This happens because I have to used the ide-generic kernel module to boot from my ide disks.
I typed in:
modprobe ide-generic 

But my system said that no module with that name was available... (this is where I panicked and retyped that about twenty times trying different combinations of ide, -,_ and generic). Naturally that didn't accomplish anything so I googled a bit and found that ide-generic had been removed from the kernel packages and been replaced by pata_legacy.ko
So instead I tried:
modprobe pata-legacy 

The module loaded and my drives were recognized. I hit CTRL-D and the boot resumed.

As soon as my system was up and running I replaced ide-generic with pata-legacy in /etc/initramfs-tools/modules
and issued:
sudo update-initramfs -u 

...and rebooted without a hitch. Well actually, first I replaced it with pata-generic, which of course is very wrong and got dropped to busybox again. But I will never admit to that. ;)

Also I must say that cupt feels a tad bit snappier than apt-get.