Showing posts with label electronics. Show all posts
Showing posts with label electronics. Show all posts

Friday, May 01, 2009

micro controller woes


A couple of years ago I bought a little circuit(pictured top left) that had two relays controlled by a 315MHz radio and a range of 1500 feet. Luck was not on my side or maybe just misused it didn't last a week, it just up and stopped working. I just threw it in my box of electronic parts and forgot about it until I got my micro controller and started to rummage for interesting circuits to interface with it. It was a good thing I didn't throw it away as a closer inspection revealed a radio daughter board that could potentially be used with my micro controller so I swiftly soldered it off.

I had no idea if this piece of the circuit even worked but I carried my bits and bobs to work and started to plug up the breadboard. When I pushed button 1 and 2 I got the led to blink rapidly but it was continuously fluctuating when no buttons were pressed. I made the assertions that it was background noise and that the circuit outputted a +5v square wave. I went to work writing the C code to prove my hypothesis and read data from the radio. I was able quickly get some code to dump thousands of ones and zeros as it just sampled the input pin each couple of clock cycles.

It took me quite a while to figure out what to do with the 1's and 0's but eventually I massaged them into something usable with the help of gnuplot.

This first graph shows a wide view as I pressed button 1 four times. The outcome looked good like there was something usable there.
I zoomed in a bit more and got this second graph, yup a detectable cycling signal was definitely there.

The only thing left to do was determine if the other button produced a similar signal with a different detectable signature and the bottom two graphs showed the signal from the two buttons magnified to a similar point of interest and there was my different but detectable signals where clearly visible. Eureka!

The next problem is to develop C code to detect those two signals in a stream of bits. I wrote my code but it was not triggering when I pressed the buttons. I soon realized I was suffering from the observer effect in which my code to detect the patterns as I sampled the data output from the radio added delays in the detection that changed the signal signature.

I wished I could turn back the hands of time and pay just that much more attention in school, it would have made dealing with all of this a lot easier. I eventually got the circuit matching the signals and it was mostly reliable. Button two triggered all the time and from far distances but button one worked when it felt like. Mission accomplished so I packed my stuff and sent it back home. Of course I attracted quite a bit of attention from my co-workers again during those couple of days while developing the code for it. Those who thought I was working on a bomb before when I was working on the timing circuit eyes definitely popped open a bit wider this time when they saw the remote control. I pulled out the antenna a bit more just to mess with them lol.

Tuesday, April 14, 2009

scrabble time

As per requests in my last post here is a video made with my home made timer and my trusty canon 400d. Sorry I couldn't embed the video I'm new to this and I thought Vimeo allowed it. I also must apologize for not adding a sound track to the movie as I haven't figured out on how to get my open source tools to do it yet. On that note I should mention how I did it in the first place in case any other adventurous individual searches and finds this post.

$ cat .mplayer/mencoder.conf
[x264-vimeo]
profile-desc="h264 high res"
vf=pullup,softskip,pp=fd,hqdn3d,harddup,scale=1280:720
lavdopts=threads=2
ovc=x264=yes
x264encopts=threads=auto:subq=5:frameref=4:me=umh:partitions=all:b-pyramid=yes:qcomp=0.8:trellis=1:8x8dct=yes:bframes=3:weightb=yes:bitrate=3000
sws=10
$ mencoder -nosound mf://data/scrabble/*.jpg -mf type=jpg:fps=3 -profile x264-vimeo -o final-edit.mkv
This just assumes the reader knows their way around linux. I compiled mplayer/mencoder with x264 support enabled, then ran the mencoder to compile the individual photos into a vimeo/youtube acceptable HD video format. If anyone knows of a GTK front end or a how I can encode an audio track into the mix let me know how.

On a less mentally taxing, I got my Arduino based micro controller today. This has an amtel atmega168 chip at it's core running at a whole 16MHz, has 16KB flash, 1KB RAM, 0.5KB EEPROM and a whole slew of digital and analog I/O pins. It isn't anything to gawk at but it was relatively cheap and easy to program. I haven't done much with it yet but as soon as I got home I scrambled to build a power supply[6AA batteries] for it as you can see in the background and coded my first program for it to display that message for all three of my blog readers.

I hope y'all enjoyed the time lapse video at least if the rest of this post confused you.


-- EDIT -- 16/04/09

Several days later and I just figured out how to embed videos now. you won't get the full HD video unless you click the link and go to the actual Vimeo page though so still do that :).

Scrabble time lapse from Adrian W.

Sunday, April 05, 2009

The bane of my existence

For the past week I have been messing around with electronics with hope to build a timer based remote shutter trigger for my camera to make time lapse movies. I did my research, I had most of the requisite parts I only needed to find a 555 timer chip which I found locally at systems and innovations for what would work out to 0.50 USD. Normally these local people rip you off if you can even find a store that has items in stock.

So everything was a go and I plugged up my breadboard based on some schematics I found online that was supposed to achieve my stated goal.. fail. Nothing happened, well the green led did come on but the timer wasn't oscillating, so it was back to the drawing board. I read the 555 tutorial with a new goal of understanding the timer and made a new circuit of my own design that got it putting out a pulse, a step in the right direction.

I had given up from the start on doing this in the few hours I spend at home before I fall asleep at night so I carried my bits and bobs to the corporate office and was working in my cubicle *sigh*. Most of the people who noticed I was doing something other than hacking away at my keyboard made some comment of me making a device to blow them up. lol really? is this the first thing that comes to peoples mind when they see tiny wires and batteries?

After several days of failure I eventually settled on a design that gave me an adjustable pulse train with the right duty cycle I hooked it up to my camera, it works! With sparse subjects for time lapse photography I selected myself to star my first recording. I have long had interest in seeing what I did in my sleep so I left my camera snapping away as I apparently to tossed and turned but never slept on my stomach but I'm sure these details will bore you along with the rest of this post so I'll spare my readers any more and also spare y'all the HD[1080p] video of me sleeping too lol.

Also in news last week, my car battery gave up the ghost and decided to leave me stranded at home one morning. I went over to my neighbour and knocked on his window to ask him for a jump start. He was so fast asleep which I knew he would be and I felt bad but I needed to leave and wasn't about to fork out what ever taxis charge these days to get on my way. Of course he didn't have any jumper cables but us being resourceful men I fashioned two cables capable of carrying 30-45A that should be sufficient to turn over my small engine. It worked and all was well but this was the first time in 5 years of me owning my car that I turned the key and it didn't start. It was different, made me want to be more prepared, time to get a new[less old] car.. too bad I can't afford it now.