Let's Make Robots!

Want to connect an IR remote to my PICAXE, but how?

Hi everybody! I'm trying to hook up a Paralax Infrared Remote Kit to my PICAXE 28X2 board, but I get conflicting information about how to hook it up. The Paralax data sheet shows the V+ going directly to the 5V power source, the V- going directly to the ground, with the "message" wire going to a "pin" via a resistor. But if I look into the PICAXE board's various manuals looking at the "infrain" command information, they show the V+ wire splitting off to a 4.7uF capacitor and the "message" wire connected to the 5V source via a 4k7 resistor.

Hmm. Is the PICAXE manual just overdoing it? Or is the Paralax manual simply providing how to wire things up if connecting to their own BASIC Stamp board?

 

Finally, could you also help me out with regards to which type of pin I should connect the "message" wire to? Is it an Analogue input? A digital input? I know this board has seperate connections availible specifically for IR remote signals, but I don't know how to identify them in the code.

Anything you can do to help me out in the most straight forward way would be very much appreciated.

Cheers.

Ian

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

i just looked at  the data sheet for the PNA series it appears from lft to rgt 1,2,3 pinout,but on the casing they put the number 3 above pin1 in the app notes from parallax it's revesed 3,2,1 it has confused me, and you have to be careful here because there easy to fry.

how i see it AND I COULD BE WRONG is lft to rgt  pin1 is signal thats going to the picaxe ,pin 2 going to ground,pin3 going to vdd if that is right then add the resister between  pin3 and 1. HOPING i dont live upto my name on this and someone has i wiring diagram they can share.

              jinx 

post #3 appears to confirm my thinking

http://forums.parallax.com/showthread.php?101465-IR-Detectors&highlight=pna4601

I took a look at the picaxe manual and they use the same illustration for 'infrain', 'infrain2' and 'irin'. If you look close they show it both ways...! The part sketch above is correct. The schematic layout is backwards. This is the way my software shows it, looking at the lens on the front with pins pointing down:

More importantly though, this is the same way the .pdf datasheet for the sensor shows them.

Looking at the lens side with pins down the left pin is Output (the signal going to the picaxe), middle pin is ground (or minus) and the right pin is Vs the plus supply voltage ("tolerated supply voltage range : 4.5V<VS<5.5V")

and under Absolute Maximum Values, it says 6.0 V. maximum)

By the way, the data sheet I have has an application drawing that is similar to the picxaxe drawing, except for a couple things. They show the same 4.7 µF capacitor, but where picaxe shows  a 4.7 KΩ resistor (aka 4k7), the spec sheet says 10 KΩ recommended.  Also the 4.7 µF cap is across between pin 2 and pin 3, but there is a 330 Ω resistor between there and the +5 volt supply. That resistor and the capacitor have little asterisks and a note that says:      "only necessary to suppress power supply disturbances"

 

Oh, and something that was answered below, but I will confirm, is that neither "infrain" and "infrain2" work on the 28X2 chips. For that chip use the "irin" command.   "infrain" worked with the 18X, 28A, 28X and 40X. The "infrain2" command works on the 08M, 08M2, 14M, 14M2, 18A, 18M, 18M2, 18X, 20M2, 28A, 28x and 40X.

Jinks gave you good advice too. The capacitor is there to get rid of noise that might come from the power supply. It's less likely you will get such noise if you are on batteries, but if you are using a wall supply (mains) then there can be lots of electrical noise and the capacitor is needed, sometimes much larger than that one.

hi,

       it is possible to leave out  4.7 cap providing power supply is fairly steady.BUT could you not solder directly onto pin2 and pin3 just  below the casing of the ir receiver.

   Well done for signing up  the picaxe community is second  only to LMR  for polite and sear wealth of  advice and support, give the modarators time to ok your account couple hours or day then you have access to the pdf.

can  you breadboard  a setup to experiment sure would be helpful before commiting  to the board.

 hi

i just tested the irin command on the on a 28x2  it appears to work on most of the pins

followed the setup in  manual 2 for the ir receiver with a test  code lifted from the manual        

main:
irin [1000,main],b.7,b0 ;wait for new signal
if b0 = 1 then swon1 ;switch on 1
if b0 = 2 then swoff1 ;switch off 1
goto main
swon1: high c.4
goto main
swoff1: low c.4
goto mainp

 

Hi jinx. In the line:

irin [1000, main], b.7,b0

 

What does "b.7" denote? Where/how is it used by the program?

Thanks again for your help.

In the newer (X2 and M2) versions of picaxe they changed the individual pin names by adding that letter and dot in there. There are 8 pins (0 thru 7) in port B, and 8 pins in port C. These are called B.0 through B.7 and C.0 through C.7 respectively. So when you want to designate a certain pin, that is what you call them in the programming. (For the 28X2 there are also 5 pins in Port A; named A.0 through A.4)

In the Picaxe manual #2 you may read about this on page 27.

Here is a partial quote from that page:

 

"The first PICAXE chips had a maximum of 8 input and 8 output pins, so there

was no need for a port naming scheme, as there was only one default input port

and one default output port for each chip.

Therefore input and outputs pins were just referred to by their pin number

e.g.

Output commands     Input Commands

high 1                           count 2, 100, w1

sound 2, (50,50)           pulsin 1, 1, w1

serout 3, N2400, (b1)   serin 0, N2400, b3

However on later M2 and X2 PICAXE parts more flexibility was added by

allowing almost all of the pins to be configured as inputs or outputs as desired.

 

e.g. Output commands Input Commands

high B.1                         count A.2, 100, w1

sound C.2, (50,50)         pulsin B.1, 1, w1

 

Thanks Dan. Very detailed. That really clears things up. I'm going to start a new forum post, but since I'm getting such great advice (from everybody) on this post, I'll just go ahead and ask the next question:

 

I now have a PICAXE 28x1 board hooked up to a relay circuit as depicted in the attached photo. For some very odd reason, everything was working just dandy when the two bread boards were seperate. No problems. A basic program to open and close the relays made that beautiful clicking noise that was music to my ears. I needed two of these set ups to run my motors and there wasn't enough room on one bread board, so I duplicated the setup on a second breadboard and then used jumpers to connect the V+ and V- bars of both boards (again, please see photo). I added an IR remote sensor to the board (see on the far left of the photo) and am pretty confident that my wiring is ok. Please correct me if I am wrong. 

But here's the thing: Now that everything is set up and more or less secured into place, I want to download a new program into the PICAXE board/chip. I keep getting the dreaded "Hardware not found" message and I can't figure out why. I am reading a nice and steady 4.7 volts from my power source (3xAA batteries), and I have measured the same voltage to be flowing through the board. I have used a multimeter to measure every V+ and V- contact identified by the fantastic PICAXE 28 pin project page provided by Fritz (thanks Fritz!) on LMR. Everything reads the same voltage. The cable has been accepted by the computer (ie the drivers were installed and I have tested the tip of the cable using the Test Port function) and everything about the cable seems to be just fine.

No blue smoke has appeared, nothing smells funny. Nothing is running hot. But it's like the PICAXE board is just dead inside/not responding to the AXEpad program. 

Any tips on how to narrow this down? I am a school teacher trying desperately to finish up a project for my kids by the end of the week/school year. Any help that you can give would be so appreciated. Thanks!

Ian

 

Oh, sorry, just caught the additional question (Was behind in my emails).

Let me see if I can figure out the problem..  (Make the picture big enough to hopefully tell what's wrong).

I'll be back when I do.

ADDED: (back) Sorry, I cannot spot anything odd from the picture, so let me try something else.

Two things come to mind.  (1) the port on the computer is not registering properly. Did you change ports? or did you change computers?  For example, can you plug something else into the same port? (like a thumbnail / travel-drive for example). Just try anything to verify that the port is working. (Not just a power plug like to charge a phone).  If it is working for data then we must go to the second possibility.

(2) there is a not-so-obvious short or open circuit somewhere.

 My advice there would be to temporarily unhook the second board (relay board) and check the picaxe board by itself. Oh and if at any time you unplugged the picaxe chip from the project board, be sure it got plugged back in the right way around.  Notch in the end/top of the picaxe towards the end of the board with the program plug jack. It looks okay in the picture, but I cannot be certain.

The Program Editor just needs to see the picaxe with power on it to show the port active. It doesn't care what else is hooked to it as long as the picaxe chip is powered up and working.  If it works with everything else unplugged then you know there is a short somewhere and careful step-by-step searching should find it.

If it doesn't work (and especially if the picaxe has been unplugged before) look very closely at the pins of the picaxe chip to be sure they are all plugged into the socket properly.  Sometimes a pin can miss the socket and bend underneath the chip where it is not obvious that there is a problem.

All I can think of at the moment.  Good luck.

 

 

Thanks Dan. This adds to the mounting evidence that my chip is fried haha. I have checked the port, and have successfully tested the cable. I have also disconnected my PICAXE board from the circuit and tried to upload the program. No difference. I think that somewhere along the way I did something like power the PICAXE board without properly grounding it. Would this fry the chip? I suspect so. I have ordered a new chip, but am worried about popping it back in and having the same mystery problem fry it again. I'll let you know when I know. Thanks again for all your advice.