• Welcome to Randomland - The Forum. Please login or sign up.
 
Apr 28, 2024, 01:41 PM

News:

Get Out, See Green!


I made an LED blink!

Started by Nick, Feb 12, 2010, 08:26 PM

Previous topic - Next topic

Nick

Feb 12, 2010, 08:26 PM Last Edit: Feb 13, 2010, 04:22 PM by Nick
So, in my quest to find myself a constructive project I bounced around some ideas. One of them was that media database program (that still will get written!) Another was to make something using the limited knowledge of electronics I gained in high-school.  So after looking online a bit I found a WIFI driven RC car. I decided that it ooked like a good project to start with and down the road I went to learn about microcontrollers.

Using a PIC16F628A I have made an LED blink programmatically. Using C code even as I cant stand assembly. Forgive me if I sound a little worked up over so little, but I find all this rather exciting. Loading code onto a tinny little chip to accomplish some task in the real world, even if its just blinking an LED is kinda cool.


Super crappy video :)


My next order of business was to get the computer talking to the controller via serial ports. Finding a few good tutorials that used a different compiler then the one I had, and as such presented me with incompatible code. I used the free Hi-Tech C lite compiler. Its ok. But their demonstration code is confusing and documentation is atrocious.  Anyway, I took a serial communication demo they had written for another chip and did some slight modifications to make it work for the 16F628A. Very little needed changing. Just removed a line that stopped the compiler if the wrong chip was being compiled for and some useless EEPROM stuff and BAM. It's ALIVE. It was easier then I was expecting to get it working. But only because of the demo code. I could find no good tutorial for learning anything basic about the language anywhere. I think they want to sell classes so they have poor documentation.  Seems dumb.  So after a few tests in the microchip simulator, cleaning up the code some to remove strangeness that made no sense and seemed to break things and burning the code to the chip it worked!
Next is to write code to control a motor using PWM , and then build the associated hardware to be controlled. I have all the parts.... now to put them together. H-bridges and logic gates!


The output to the serial port. It also echos any characters you send.

In case you are the kind to wonder. Its alive.

 

Brad

Awesome! I've always wanted to get into that stuff. Good luck on your RC car project, I'm interested to see your results.

zourtney

Dude, dude, check one dude!

That's pretty sweet. I'd like to see that blinking action in person. I took a class or two in college where I did similar stuff. Just making music with assembly was very, very exciting!

Nick

Cool. What did you use for that? And you should come have a look sometime if you want.

zourtney

It was a microcontrollers class. I actually liked the lab portion of that class a lot. And there were certainly other classes like it in the "hardware" vein of education. But the frustrations of electrical theory made me focus on software instead.

And yeah, we should do stuff. And I'll peak at your breadboard!

zourtney

Last week, I attempted failed to repair an Xbox cord that a naughty kitty got ahold of. I failed, but there is plenty of more wire to try with :) My soldering skills leave much to be desired. Got any cool project ideas? Have you played with your breadboard any more? I'd like to be a little more knowledgeable about these things. Just like most things.

Nick

 I got employed and then the sun came out, so I have shelved the breadboard for a while. I still want to make  something with it though. Wifi robot seems where I was heading before. And I think I have all the parts. Just need to assemble them and write some code. And then figure out what I did wrong and why its not working.

zourtney

That sounds cool. I have many projects, but this sounds like another fun one.

zourtney

So, not that I don't have other projects, but I'm interested in seeing this in actionsome time. And "the codes" (as the internets say). I'm always interested in knowing new ways to use hardware and software :) It can inspire!

Nick

Its fun and interesting. Like I think i said before, its using computers to interact with the 'real world.' My ultimate goal is something romotly/semi autonomously controlled with lots of cameras mounted on it. Then we can take it up to some abandoned mines and make it go exploring (or something like that.)

zourtney

Doing stuff with cameras would always be cool. I've been working with a C-based computer vision library (OpenCV). It can be used to do template matching and all kinds of cool stuff. I'm sure it'd be a bit too processor and memor intensive for your hardware, but I like the sounds of building image recognition software into something. Though I do t know what. I should finish the projects I have already started, I suppose.

Nick

Its a little more then what my hardware can handle, but I started cheap. You could easily get something that runs a basic linux kernel at a few hundred (or even thousand) mega hertz. The router I bought can probably handle some of it, unless it needs lots of ram (relatively speaking of course. My idea of lots of ram in 6 gigabytes, though embedded systems think that 128m is lots of ram.)

zourtney

I wonder if there are any projects out there which run custom Linux kernels on old mobile device hardware. We're kind of at the point now where many people have two or three retired ones lying around the house. Sure, most aren't too powerful, but it's got everything you need...other than a simple way to connect it to your computer, of course  :-\

Nick

Some old phones have linux for them :) Easiest to get get an older (strange to say older as they have barely been out more then a year or two) android phone.  Linux to the core and easy to program for (relatively easy anyway.) You could build a whole flight computer out of one. With GPS built in you would just have to make a custom altimeter for it (thats easier then it sounds if the phone has a USB host controller built in) Then you could use the camera for horizon detection and have a FULL autopilot setup. :) Sounds fun.

zourtney

That's cool. Too many projects, so little time :(