triple...please erase these last two.
triple...please erase these last two.
Last edited by .n0rig.; - 16th January 2009 at 04:08.
.n0rig.,
I'll try to get more detail to you this evening if you need it, but here's some info to get you started.
The button command will work on any I/O so long as the pin you select is set to a digital output. As I'm a little more familar with 16 and 18 series, let's stick with the 16F684. Now, most of the pins on this chip can be used as analog or comparator inputs, so you need to turn these off. Something like this (sorry, this is quick and dirty):
Now, as far as hookup, you should connect a 10k resistor to 5V (whatever is powering VDD) and to pin RC0. Connect one side of the momentary switch to RC0 and the other to ground. Connect the positive side of an LED to 5V and the other to, say, a 1k resistor and the other side of the resistor to RC4. Assuming I made no mistakes, you should see the LED blink once when you press the switch.Code:CMCON0 = %00000111 ' Turn off comparator bits and set pins to digital I/O ADCON0.0 = 0 ' Disable ADC TRISC = %00001111 ' Make port c pins 0-3 inputs and the rest as outputs b0 VAR byte ' Byte variable for button HIGH PORTC.4 Start: BUTTON PORTC.0, 0, 255, 0, b0, 1, drive_forward ' If button is pressed, goto drive_forward routine GOTO Start drive_forward: LOW PORTC.4 PAUSE 500 HIGH PORTC.4 PAUSE PORTC.4 goto Start
To control motors, it depends on what you want to do. If you're NOT trying to vary the speed and just want to turn the motor on and off (one speed), I'd look at an H-bridge IC or make one with transistors or MOSFETs. Another option is to use a DPDT and a simple SPST relay, which you'd have to interface to the PIC with transistors or an optoisolator. The DPDT will change the direction will the SPST will turn the motor on and off. If you do want to vary the speed keep in mind your controller must be able to vary the signal to the PIC as well. If you want to go this route, I'd search the forum on PWM and/or motors. The rumble packs are just simple brushed DC motors as far as I know, so if one speed is okay, you just feed them power and they go - they don't need PWM to function. You would use PWM to vary the speed, but my knowledge on this subject is limited at best.
As far as steering, I'd use a cheap servo and the PULSOUT command. Optionally, you could use continuous servos for the wheels too and get varying speed easy with the PULSOUT command, but it won't go very fast.
Yea sounds like a good idea, I figured out how to do if then commands and I think I just figured out why my buttons were not working. I didn't signify a b0 register as a byte. Anyways, what I will need most help in will be the serout and serin to connect to the chip on the car to make the car move forward, back, etc.
And can I use rumble motors from an xbox 360 controller for my main forward and reverse motions? can these be controlled like a servo or not? see, there is a requirement that we have to make the vehicle stop when at a certain time. The faster it stops the better.
thanks for all your help guys!
.n0rig.,
By chip, do you mean the PIC or are you interfacing the PIC to some chip on the car? You only need serin and serout if you're interfacing to a computer or another IC. Or do you mean to talk from one PIC (on the remote) to the PIC on the car?Code:Anyways, what I will need most help in will be the serout and serin to connect to the chip on the car to make the car move forward, back, etc.
I doubt you can control the motors like a servo. Rumble packs are typically DC brushed motors with a counterweight on the end that act like pager motors or the vibration ringer in a cellphone. They'll be full on or off like a standard DC motor. You'd have to use PWM with some type of interface circuitry or buy a motor controller that can interface with the PIC.
If you'd like to dive further into motor control, a quick Google search turned this up:
http://www.newark.com/pdfs/techartic...ksBrochure.pdf
http://ww1.microchip.com/downloads/e...tes/00893a.pdf
http://ww1.microchip.com/downloads/e...tes/00905a.pdf
http://www.seattlerobotics.org/encod...implemotor.htm
I haven't looked at this in detail, but you might get away building this and using pulsout:
http://www.aaroncake.net/CIRCUITS/motorcon.asp
However, I think this would do everything you want and pretty cheaply:
http://www.parallax.com/Store/Access...%2cProductName
elec_mech, you are really helpful and thank you for finding those links for me.In regards to some of your questions, yes, I will be using serout to "wireless" interface like this:
me -> push buttons on remote -> remote has 16F684 in it -> which is connected to an RF transceiver (or transmitter "tx") -> sends the info about me pushing the button(s) -> transceiver (or receiver "rx") in car receives info -> transceiver forwards received info. to another 16F684 chip in the car that is connected to either 3 or 4 rumble motors (dc) without the weights on the spindles -> this controls forward and reverse motions. With some gears and just 3 motors (two on back and one of front between two front tires with spindle facing upward) I can make a steering system.
That right there sums up my plan for this. I don't need anything fancy for controlling the car, nothing that exceeds 30M probably (RF quality).
I am still lost on what actual supplies I can use that are not too expensive. If you have done something like this before I would greatly appreciate either a sample code, parts list, or guides for me. I really appreciate all of your help...this is going to be a really important event for me if I finish this as it will be one of the biggest completed codes I could possibly make. With the knowledge that I attain from this, I can put it to use in the future. Anyways, thanks...just keep all this information rolling guys.
Regards,
n0rig
.n0rig.,
Ahh, okay. It's been years since I worked on an IR project, so I did a quick search on the forum under 'infrared' and found some postings you might want to check out:
http://www.picbasic.co.uk/forum/show...light=infrared
http://www.picbasic.co.uk/forum/show...light=infrared
Now, by all accounts, everyone said Bruce was the man on IR and to check out the solutions on his website. These are both inexpensive and relatively easy to implement.
http://www.rentron.com/Infrared_Communication.htm
http://www.rentron.com/remote.htm
http://rentron.com/PicBasic/IR_Chips.htm
If you'd consider using a universal TV remote programmed with Sony signals, as a backup plan - I'm not encouraging you to abandon your plans for making your own remote - then: http://www.rentron.com/remote_control/IR-D15A.htm
Hope this helps and good luck!
okay, after spending about an hour reading through rentron's articles...I have come to the conclusion that I will need to generate the signal, run that through my IR transceiver and then collect it again at the transceiver in the car. I have three transceiver here that have an in and out for RF communication. I am sure I will not need to encode the data stream, right?
Well, I have two of these:
http://www.mouser.com/search/Product...CYV8QSMg%3D%3D
100+ 12F683 I/P
~6 16F683 I/P
~3 16F616
1 18F2550
~500 tact switches
~3000 ft kynar wire (30 awg)
no oscilloscope
1 voltimeter
and soldering iron and glue
other basics
Soo...I am not sure if this is what all I may need to make an IR link between two chips. I just need your guidance guys in all of this. I will post pictures of it if I finish it![]()
Last edited by .n0rig.; - 18th January 2009 at 03:35.
Bookmarks