Showing posts with label PIC-16F877A. Show all posts
Showing posts with label PIC-16F877A. Show all posts

Sunday, January 18, 2009

IR Receiver Revisited, Improved

Lately I've come up with many ideas for circuits that need to be remotely controlled. I thought that I'd revisit my old IR project and improve it so that it is useable in other circuits. 

Here is a video of it working:


In order to store the IR signal, you need to turn a switch on and feed the microcontroller the IR signal you want it to remember. The green light means it recognized the stored signal. In the video above, I had the receiver circuit set to receive the 1 button, and changed it to wait for the 2 button to be pressed.

Further improvements I plan to make are: to scale down its size, to make it more reliable, and design a board layout for it.

With this circuit completed I can finally start making remote controlled robots and other cool electronic devices.

Monday, December 22, 2008

Re-remake

After confirming that the pic servo device worked properly I uploaded the design to Batchpcb.com and had circuit boards printed. However, on the board there were no traces. The board was pretty much garbage; they were useless.

Recently I relearned how to design circuit boards from schematics and redid the whole thing. Here is the new layout for the board.


A good tutorial for designing board layouts from circuit schematics can be found on Sparkfun.com which can also be accessed through Batchpcb.comHopefully this version of the circuit board will turn out much better than the previous one.

If it comes out successfully I may make this into a kit which will be available to anyone who is interested in learning about PWM (pulse width modulation) and ADC (analog to digital conversion) in pic microcontrollers.

Saturday, June 28, 2008

More Success on the pic pwm!

I finally figured out how to decrease the amount of jitter in the servo produced by the flickering of values coming from the Analog to Digital Converter!

The pic microcontroller I use has a 10bit ADC resolution. Until now I thought this was the most annoying thing ever, since most of the instructions are byte (8bit) operations. They gave you the option of having the output of the ADC Left Justified or Right Justified, so there was always this pair of bits that was lost.
I just realized recently that if I ignore the two lower most bits, and I force the ADC output to be 8bits, I can get the flickering of the ADC values to not affect the pwm signals. This way I can clean up the movement of the servos, and not have to add resistors as I previously did.

Thursday, June 26, 2008

Remake

With the help of a fellow hobbyist in Europe, I was able to remake a better servo board that actually works. Visit his website at http://max8888.orconhosting.net.nz/projects.htm.

Saturday, June 21, 2008

Failure




This is the circuit board I printed to operate the robotic arm. I don't know what happened, but it failed miserably.

Friday, June 20, 2008

Timer1

With the help of my mentor, I was finally able to figure out how to use the Timer1 module in the microcontroller.

Now that I know how to use it, I will be able to operate multiple servos easily.

Here is the code: tmr1.asm

Thursday, June 12, 2008

pic pwm

Recently I helped a high school sophomore work on a school project. His project was to make a glove that can control a robotic arm. We figured that using a potentiometer and a pic microcontroller would do the trick. However, at that point I didn't know how to use pwm nor the analog to digital converter.

After a few weekends and all-nighters I was finally able to figure out how to put everything together, but unfortunately, in the end, all I got to work was the wrist and the gripper.

One problem that I ran into was the ADC. The microcontroller I used has one byte registers, but the ADC had a 10-bit resolution. I overcame this problem by making sure that the voltage drop on the potentiometer never exceeded a fourth of the reference voltage. I did this by putting a resistor with resistance triple that of the maximum of the potentiometer in series with it.

The other problem that I ran into was the programming. Since I am not so advanced in programming in assembly, I had to use brute force to make the pwm to work. This was the reason why I couldn't operate more than two servos. However, now I know that I can use interrupts to make it work much easier.

Although the deadline has already passed, I will continue to work on this.

Videos of various tests: servo test, gripper test, wrist test.

Saturday, April 26, 2008

It Works!

Here is a video of it working:




There were two reasons to why it took so long for this to work. One was that my delay loop was not necessarily the length that I wanted it to be. Instead of being 0.1ms it was 1ms, and I was trying to make it work with the wrong timing. The other reason was that I had the IR output plugged into the wrong port.

But anyways... It works!!

The code: IRsony.asm

Thursday, April 24, 2008

Not Working Yet

Recently (finally...) I found out that IR remote don't work the way I assumed they do. I had previously thought that the IR remotes sent out simple signals where on is 1 and off is 0. However, this turned out to be completely wrong! Even worse, different companies used different styles of signals!

Since I was using a Sony remote, I decided to do a little research on how Sony does it.
This is what I found online

,and here is my new program for it: IRsony.asm

Saturday, April 5, 2008

Quick IR Test Circuit

Here is a quick test to see if the IR receiver works.




Here is the schematic.

My First Printed Circuit Board

Today, with the help of a friend of mine, I made my first printed circuit board. I used Eagle CAD to design my circuit. Then, I printed it onto photo paper using a laser printer. After that I melted the toner on the photo paper onto a copper plate and etched it.

This board is my IR receiver module.

Sunday, March 23, 2008

3-Digit display

so...

here is the 7 segmented led display at work using a table read.













and here is the code: numDisplay.asm

I'm thinking of making the numbers increment.

Wednesday, February 27, 2008

ASM Table Read Implemeted

I was finally able to implement a table read in my LED program.

Now that I tested this I can move onto using the 7-segment LEDs that I put together previously. This way I can get decimal feed back rather than binary, which is much easier to read.

It looks like I will be getting to finish my IR project soon.

Here is the code: tableRead.asm

Here is a video of what it does:


Sunday, February 24, 2008

Problem Solved

Just a while ago I was working on the POV project, but because of a problem that I didn't mention earlier I had to pause the project and work on other projects. At that time there was one pin that wouldn't give an output or take an input no matter which 16f877a chip I tried. I thought the source of the problem was in the programmer that I was using.

Today, while reading through the 16f8xxa data sheet, I found out that all I had to do was disable the LVP (Low Voltage ICSP) which is on by default and disables IO through RB3 on all pics in this model.

Now I can do this just with PORTB.




However, I will continue my work on the IR project.

Saturday, February 16, 2008

ASM Code for New IR Receiver

This is the new IR receiver code that I wrote a couple weeks ago.

IR Code.asm

Again, just like the other file, without the rest of the code this will not do anything for you.

The code linked above receives and stores the first eight bits of the IR signal from what ever remote I point at it. I have not yet written the part of the program that displays the 8-bit binary number as a decimal number from 0 to 255 on the seven segment display board that I made just a little while ago.

Saturday, February 2, 2008

Fixing the IR

Instead of using the RabbitCore and Dynamic C to do my infrared project, I decided to continue working on it using a pic micro controller and by programming it with assembly. I have already completed the code that takes care of receiving the signals from the Radio Shack IR receiver. I still have to work on the part that tells me the signals that it recorded.

Friday, November 23, 2007

Second ASM code!

This is my second assembly code that worked! I left my first one out because it only turns one LED on and off. This one flashes four LEDs sequentially. Although my code is successful, I'm finding that writing and editing the code is becoming very tedious. Right now I am trying to modify the code so that the parts that the microcontrollers are running actually looks simpler (perhaps by making a library of set patterns so that I can call them). This program was written and compiled through MPLAB, and was loaded to the PIC-16F877A microcontroller through the mdfly programmer using their PIC+PRO software.

This is the program: flashLED.asm

WARNING! this code will not run without initialization and other include files.


Here is a video of what it does.