Showing posts with label micro controller. Show all posts
Showing posts with label micro controller. Show all posts

Wednesday, January 01, 2014

Like a raft or rudderless boat

I haven't been a very good blogger over the past few years and it is unlikely that I will improve over the years to come. In fact I have had internal turmoil throughout 2013 as to whether or not to post a final entry informing those who may stumble upon this lonely site or to delete the whole site all together. I may have stated this before but it is simply because I am in a different state of mind from when I started blogging in 2006 or I could even go as far as to say I am a whole different person :-p. Sorry for the nerd joke, I hope someone got it but anyway lets come off this topic.

A while back I blogged about getting a clone of the original Arduino board and it was just as quickly banished to collecting dust on my desk as I grew board of some of the limitations(both hardware and software) I found with it. So I moved from the AVR camp and moved to PIC. If you are unfamiliar in the MCU world this is the equivalent to the following analogies:

  • Moving from Intel to AMD
  • Moving from Nvidia to ATI
  • Moving from IOS to Android
  • Moving from a Toyota Supra to Nissan Skyline
  • Moving from a Mitzubishi Evolution to Subaru Impreza
  • Moving from a frozen yogurt preference to icecream
or vice-versa depending on which camp you sit in. The PIC 12f683, 8pin dip MCUs pictured below, forced me to learn assembly. This is a very time intensive hobby so I didn't get a chance to fully utilize all of its peripherals in my projects before I grew tired of tediously moving registers around, loading w, working only with 8bit registers, not having hardware multiply/divide operations and the manual memory management so I bought some more advanced PIC MCUs that could handle the C programming language.
Apparently I bought low voltage chips that required a special programmer, I tried using a pikit3 and didn't have much success. I didn't really try that hard but I moved on, I realized that Arduinos were dirt cheap if you bought them in the mini flavors as pictured above. The programmer in the photo is some generic serial type one and it doesn't work with the usb to rs232 cables so I need a real serial port to use it. Since we are on the topic of this photo lets take some time to admire my work of making a 4 braid ttl uart cable for communicating with these breadboard platforms lol

Hopefully the MCU aspect of my electronics hobby doesn't fall to its usual fate of collecting dust on my desk or draw somewhere for 2014, I am waiting for the delivery of a few other items that should make for some useful projects: 2.4GHz wireless transceivers, RTCs, temperature sensors, microphones, accelerometers and gyroscopes.

Sorry to start off the year with such a geeky post, hopefully my next post is this year and soon(I only did one post last year) will be about new years resolutions or lack of any for me. So what are your resolutions for this year?

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.