NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.
Microcontroller Programming » Simple Controlling Devices With PC
August 15, 2009 by Nerdful_com |
Here I have made a simple project that only turns on/off 5 LEDs. I have tried to make it as simple as possible, almost like a template to start off a new project.
|
---|---|
August 15, 2009 by Nerdful_com |
In this demo I put 5 LEDs in PB1 to PB5 (MCU pins 19, 18, 17, 16, 15) and then assign numbers 1 to 5 on PC keyboard to turn on each individual LED and keys q,w,e,r,t to turn off each of the lights. This project communicates with your PC through a RS232 serial interface that came with your NerdKit AVR kit and all parts used came with the kit too! Next I am creating a Visual Basic 6 application using MSComm for Windows where you can click a button to send the commands (will post a link to VB6 project when I am done). I could even make it so there was a web based interface on my web server so people could turn the LEDs on and off over the internet with ASP, PHP or Perl. |
August 15, 2009 by Nerdful_com |
Ok, I promised I would post the source code for a Visual Basic (VB6) project. Also, included is a compiled version (used COM port 5). Download VB6 5 LED Controller for Windows users. Simply click a simple button to send the commands (turn each individual light on or off, turn all the lights off/on at once) to our NerdKit. You may have to change the COM port (I am using COM5 in my example). |
August 16, 2009 by Nerdful_com |
Here is a VIDEO of it in action. By Nerdful.com |
August 17, 2009 by jbremnant |
nice! that's hot. ;-) |
August 26, 2009 by Nerdful_com |
I found a way for an old PC like a 286 or 386 to control the PC as long as the old clunker has MSDOS 6.22 (Micrososft DOS) or greater (even works in command prompt in Windows XP). Here is a sample DOS batch file that will force the 5 LEDs to become a light chaser (lights go on and off and chase each other back and forth, loops infinitely until you close the cmd.exe window). Good way to put some of those old obsolete PCs back into use instead of the garbage bin or waste dumps (better than recycling I think). Download DOS-Control-LED-on-off-with-PC.bat |
August 26, 2009 by wayward |
Hey Nerdful, that's nice! But, are you sure it will work on a pure DOS machine? Is there a PL2303 driver for DOS? USB is covered, but I couldn't find a DOS driver for PL2303. Sounds like a fun project, though. Too bad I left my 8088 XT compatible back home. :) |
August 27, 2009 by Nerdful_com |
Our kit has serial interface, couldn't that plug in to a serial port directly without the USB dongle? Most old PCs I have seen have a serial port (how most of my mice were before ps2/usb). I am not sure, I was just assuming that this would work. I do not have any PCs around that old to test on, my oldest is a Pentium 4 and it does not even have a serial port. Thanks for bringing it up though, I wish I knew 100%. |
August 27, 2009 by kostelacj |
Does anyone have any ideas about how one might use a MAC OSX to do the controlling part? The 168 part is so clear and simple, but talking with the chip programming using MAC is not so clear. Esp. since I still lose contact with the chip quite frequently. More times than not during the programming of the chip I lose connection just after the download, but before the verification has completed. So I am still looking for a good way to establish and maintain communications with the chip via the PL2303 that came with the kit. Thanks, John |
August 27, 2009 by wayward |
facepalm Yes, you are right. |
August 27, 2009 by Nerdful_com |
Control AVR Over Internet:I forgot to mention that I came up with a basic active server page (ASP) script that runs on WIndows server OS (code simply turns on LED1). Here it is:
|
September 09, 2009 by Nerdful_com |
VOICE RECOGNITION FOR AVR: Here is a quick blog about using speech recognition to control your projects over UART, visit nerdful.com/nerd/blog.asp?avr=26 |
October 01, 2009 by Farmerjoecoledge |
Nerful, i'm missing a piece. This has got the potential to be the start of something good. So i've got the project.c loaded and pushing the buttons and nothing's happening. The download you give for the VB6 controller is missing (component mscomm32.ocx or one of it's dependantcies is not correctly registered, a file is missing or invalid) Before that the 1,2,3,4,5, should just work, no? I just saw your post and jumped right in so i probably missed something, If you could clear it up that would be great. farmerjoe |
October 01, 2009 by Farmerjoecoledge |
That's Nerdful not Nerful! This is good, i got them on with the echo 1 > com3, now i can't find the off command. ">" equals on, what's for off? fjc |
October 01, 2009 by mcai8sh4 |
Farmerjoecoledge : This is just a guess (I haven't tried this), but "echo 1 > com3" means send '1' to com3. The > char redirects the output from the previous command ('echo 1') and sends it elsewhere (to com3 in this case). Have you tried 'echo 0 > com3'? This is assuming that the program recognises 1==ON and 0==OFF. I may have done what you did - just had a quick read then jumped in, so I also may have missed something :) |
October 01, 2009 by mcai8sh4 |
sorry - after looking at the code (which I should have done initially : -10 points for me) if '1' turns LED1 on then 'q' turns LED1 off!! so...
|
October 01, 2009 by Farmerjoecoledge |
This is sweet. mcai8sh4 you got good eyes, i guess it helps where to look and what to look for. I'm blind in one eye and can't see with the other. It totally makes sence when you think about it though. So Great idea, lots of potencial. It would be alot faster with the key board as described, don't quite understand why it doesn't work that way, yet. If you know, give a shout. fjc |
October 01, 2009 by mcai8sh4 |
Glad you got it working. When you say "faster with the keyboard" do you mean by just pressing 1 or q...? If thats the case then there should be a number of ways of doing it. Depending on operating system (lets assume windows, as most people use this) one method would be to write a batch script, like Nerdfuls above, but one that accepts inputs. Something along the lines of this (note I've stole this from a random website and altered it - batch files where never my forte)
Please note, I haven't a clue if this would work, but hopefully you get the idea. Also I'm sure there are some users out there who will curse me for that sloppy method - but it's years since I touched dos. If you want to try this (don't hold your breath expecting it to work though), then simply copy the above code into a text file, with the extension ".bat" |
October 02, 2009 by Farmerjoecoledge |
Nerdful, where did you go? Your the one who started this. Your above code is writen for the key board, but it don't work. Is there a catch? mcai8sh4 thanks for your code but the Nerdful's original code should work. And like i said the vb6 controller don't work either. |
October 02, 2009 by mcai8sh4 |
fjc : No worries. I haven't seen Nerdul around for a while. He used to be in the IRC channel most nights - but hasn't been on for over 2 weeks. I can't help with VB (never tried to program in that). Best of luck to you. |
October 02, 2009 by dangraham |
I haven't tested the code yet, are you sending the keys through a terminal session to the serial port? I am on vista, MS dropped hyper terminal when they went to vista (was included in XP) you can download a trial version from Hillgrave but only lasts 30 days. Or alternatively you can use hypertm.exe & .dll from XP and copy to vista PC. Then you can use on vista. This is how I am using but is not 100% programming is ok but tx/rx with running app can drop data. The web server is a good idea because I have a server running 24/7 for business. on my final application I will connect nerdkit to this and use the web interface to monitor / control :-) |
October 03, 2009 by Farmerjoecoledge |
I fail to see how hyperterminal will work for this. Hyperterminal is for a phone is all i can see. This is turning out to be another waste. Now the command line echo don't work anymore, the little light on the programmer will light quickly but the lights don't come on anymore. So i've had enough of this one. |
January 16, 2010 by treymd |
A little late to the show, but if you need a terminal emulator ala hyperterminal, puTTY is a great piece of software, and it is open-source, so no need to pay. Just google putty and the first hit is what you want. Putty has versions for both windows and linux, and presumably can be built for the Mac as well. Putty is all you need to send/recieve to/from the serial port, and communicate with your nerdkit. |
January 20, 2010 by saleem |
Hi Nerdful_com, I used thay same VB 6 program to send data to the LED Marquee. I didn't need to change any part of your code. The only thing I changed was lower case letters to upper case, and the com port. It is good. thanks. Saleem |
Please log in to post a reply.
Did you know that microcontrollers have two different kinds of memory, program space (flash) and SRAM? Learn more...
|