Picaxe 18M2 project board infra red

Thv

New Member
Hi Im a beginner to Picaxe and I have a Picaxe 18M2 (Chi030) kit and I want to connect an Infra red sensor as an input and have a servo motor as the output but im not sure which pins to connect onto the board and if I can take out components and put new ones in could someone please help me.
 

inglewoodpete

Senior Member
Welcome to the PICAXE forum.

If you want to use the CHI030 board with an IR sensor as an input device, you will need to remove the pull-down resistor on your selected PICAXE input. This is because the IR receiver (sensor) device has an open-collector output, requiring you to add a PULL-UP resistor to allow it to work.

Refer to the irin command description in Manual 2 (BASIC Commands Manual). If you were to use Rev-Ed's code example, you will see that pin C.3 (PICAXE input pin) is not available on the 18M2. If you select pin C.2, then remove R5 for the CHI030 board and add a 4.7k pull-up from the PICAXE input-end pad of R5, with the other end going to a +5v pad on the board. (Unfortunately, the data sheet is a bit scant on details of the board and I don't have a sample to describe.)

Peter
 

Thv

New Member
Welcome to the PICAXE forum.

If you want to use the CHI030 board with an IR sensor as an input device, you will need to remove the pull-down resistor on your selected PICAXE input. This is because the IR receiver (sensor) device has an open-collector output, requiring you to add a PULL-UP resistor to allow it to work.

Refer to the irin command description in Manual 2 (BASIC Commands Manual). If you were to use Rev-Ed's code example, you will see that pin C.3 (PICAXE input pin) is not available on the 18M2. If you select pin C.2, then remove R5 for the CHI030 board and add a 4.7k pull-up from the PICAXE input-end pad of R5, with the other end going to a +5v pad on the board. (Unfortunately, the data sheet is a bit scant on details of the board and I don't have a sample to describe.)

Peter

Thanks Peter but the IR sensor has three pins and i connected it to C0 but I was wondering whether I can change out the capacitor and add the 330ohm resistor like the diagram on page 3 of this pdf http://www.wiltronics.com.au/datasheets/p-axe040.pdf
 

jims

Senior Member
Thv... The IR clicker is a great way to communicate with a Picaxe project. Here's a "snippet" program that I find helpful. It does 2 things that help me:
1: Let's me see the key code data values from my clicker,
2: Corrects the data from numeric keys so that it is the same as the value on the key (eg: key "1" will have a value of "1"; Not "0").

Code:
[color=Green]'#####################################################################
'## PICAXE 20M2 chip, and AXE133Y OLED display.
'## Subroutine gets data from an IR CLICKER (using SONY TV '## code 5001);
'## corrects the offset from the numeric keys, & shows data on the OLED display.
'## A "Do loop" pauses until the clicker key is released. Note: My clicker 
'## stops xmitting after about 4 seconds; then the  count goes to zero 
'## (this acts same as releasing the key).
'## This is a good way to see the values returned from an IR clicker.
'#####################################################################[/color]

[color=Blue]symbol ir_clicker[/color][color=DarkCyan]=[/color][color=Blue]C.0   [/color][color=Green]'B.0 (pin 18 on 20m2)[/color]
[color=Blue]symbol [/color][color=Purple]irdata[/color][color=DarkCyan]=[/color][color=Purple]b4        [/color][color=Green]'variable b4[/color]
[color=Blue]symbol oled[/color][color=DarkCyan]=[/color][color=Blue]B.7[/color]

[color=Navy]#slot 0
#picaxe [/color][color=Black]20m2[/color]
[color=Navy]#no_data           [/color][color=Green]'Prevents resetting EPROM data (if there is any).[/color]
[color=Blue]pause [/color][color=Navy]1000        [/color][color=Green]'Pause to initialize system.[/color]
[color=Blue]serout oled[/color][color=Black],[/color][color=Blue]n2400[/color][color=Black],[/color][color=Blue]([/color][color=Navy]254[/color][color=Black],[/color][color=Navy]1[/color][color=Blue])[/color][color=Black]:[/color][color=Blue]pause [/color][color=Navy]30  [/color][color=Green]'Clear display[/color]
[color=Blue]serout oled[/color][color=Black],[/color][color=Blue]n2400[/color][color=Black],[/color][color=Blue]([/color][color=Navy]254[/color][color=Black],[/color][color=Navy]128[/color][color=Black],[/color][color=Red]"  USE CLICKER   "[/color][color=Blue])[/color]

[color=Black]test1:
      [/color][color=Blue]call [/color][color=Black]get_1IR
      [/color][color=Blue]goto [/color][color=Black]test1

get_1IR:  [/color][color=Green]'* Get data from IR clicker & correct numeric key values.
       
      [/color][color=Blue]irin C.0[/color][color=Black],[/color][color=Purple]irdata  [/color][color=Green]'Get data from the IR clicker on C.0 & put into variable b4.
      [/color][color=Blue]do[/color][color=Black]:[/color][color=Blue]let [/color][color=Purple]b5[/color][color=DarkCyan]=[/color][color=Navy]0[/color][color=Black]:[/color][color=Blue]count C.0[/color][color=Black],[/color][color=Navy]50[/color][color=Black],[/color][color=Purple]b5[/color][color=Black]:[/color][color=Blue]loop until [/color][color=Purple]b5[/color][color=DarkCyan]=[/color][color=Navy]0 [/color][color=Green]'Pauses until key is released.
      [/color][color=Blue]if [/color][color=Purple]irdata[/color][color=DarkCyan]=<[/color][color=Navy]9 [/color][color=Blue]then let [/color][color=Purple]irdata[/color][color=DarkCyan]=[/color][color=Purple]irdata[/color][color=DarkCyan]+[/color][color=Navy]1[/color][color=Black]:[/color][color=Blue]endif  [/color][color=Green]'Correct numeric keys 1 thru 9.
      [/color][color=Blue]if [/color][color=Purple]irdata[/color][color=DarkCyan]=[/color][color=Navy]10 [/color][color=Blue]then let [/color][color=Purple]irdata[/color][color=DarkCyan]=[/color][color=Navy]0[/color][color=Black]:[/color][color=Blue]endif         [/color][color=Green]'Correct the 0 key.
      [/color][color=Blue]serout oled[/color][color=Black],[/color][color=Blue]n2400[/color][color=Black],[/color][color=Blue]([/color][color=Navy]254[/color][color=Black],[/color][color=Navy]1[/color][color=Blue])[/color][color=Black]:[/color][color=Blue]pause [/color][color=Navy]30        [/color][color=Green]'Clear OLED
      [/color][color=Blue]serout oled[/color][color=Black],[/color][color=Blue]n2400[/color][color=Black],[/color][color=Blue]([/color][color=Navy]254[/color][color=Black],[/color][color=Navy]128[/color][color=Black],[/color][color=Red]"IR DATA WAS: "[/color][color=Black],#[/color][color=Purple]irdata[/color][color=Blue])    [/color][color=Green]'Show key data on OLED.
      
      'debug    'NOTE: Comment out DEBUG commands when simulating with PE6.
      [/color][color=Blue]return[/color]
 

inglewoodpete

Senior Member
Thanks Peter but the IR sensor has three pins and i connected it to C0 but I was wondering whether I can change out the capacitor and add the 330ohm resistor like the diagram on page 3 of this pdf http://www.wiltronics.com.au/datasheets/p-axe040.pdf
If you are using the Wiltronics supplied receiver, it should be wired with both the 330ohm resistor and 4.7uF capacitor. It seems as if other receivers that Rev-Ed use do not need the resistor but they recommend that the capacitor should still be used. I'm not sure what you mean by "change out the capacitor". Do you mean swap it for another value?

If you are using input C.0 then you need to remove R8.
 

Thv

New Member
If you are using the Wiltronics supplied receiver, it should be wired with both the 330ohm resistor and 4.7uF capacitor. It seems as if other receivers that Rev-Ed use do not need the resistor but they recommend that the capacitor should still be used. I'm not sure what you mean by "change out the capacitor". Do you mean swap it for another value?

If you are using input C.0 then you need to remove R8.

I mean replace the 100uF capacitor on the 18M2 project board with the 4.7uF capacitor
 

inglewoodpete

Senior Member
If you are using the 330ohm resistor, then you need to add the 4.7uF capacitor. If you omit the 330ohm resistor, then you can omit the 4.7uF cap.
 

geoff07

Senior Member
My recommendation would be to retain the resistor and capacitor if you can. They act as a low-pass filter to keep noise from one chip influencing the other. That may only be a precaution, but I once had a sensor get very hot when powered directly, reason unknown, so I now retain the resistor and capacitor to ensure that the current that the sensor can take is limited.
 
Top