Newbie help please

I have the Arduino Mega, what I would like to do is to use an IR emitter (basically always on), I would like to use an IR receiver to act as a switch. So that when the IR beam is broken, say X will count up by one, when x = 10 and LED turns on. I guess my questions are, can I do this with the Arduino? can I do this using only the digital as an input for the IR receiver, and digital output for the LED? Do I need to set the IR rec. as HIGH or LOW? Thanks for any help. And if this is posted in the wrong area or I have used any bad forum manners, please let me know....first time here. Mark

In order: 1) Yes you can. 2) Probably yes for both. 3) It depends how your photodiode (I assume that's what you mean by IR receiver) is wired to your input.

However, if yours is is the sort of integrated IR receiver intended for IR remotes, then the IR emitterr will need to be switched on and off ( modulated) at around 38-40kHz.

How big is the gap between emitter and detector?

Thanks for getting back with me. It is OK to post the code I intend to use ? Also as for the photodiode, if I give you the part id number would that be for help? I plan on about a 1" gap between emitter and detector. Thanks again Mark

1) yes please use the # icon in the editor to wrap you code in a easy to read format

2) yes it might

Here's a project that one of our members Grumpy_Mike did, which is basically exactly what you want. http://www.thebox.myzen.co.uk/Hardware/Sneak_Thief.html

Has a lot of good tutorials on there, go back to his main site after that for some more http://www.thebox.myzen.co.uk/ :D

Thanks!!! Yes, that helps a great deal. I do have a questions, please keep in mind that I am new....but ...is there some mistakes on the diagram of components? It looks like the Darlington pair is not wired correct? And also is the break in the copper track (the upper one doing anything)? Just checking, as I am very new. But thanks for the site, this is great stuff. Mark

is there some mistakes on the diagram of components

If you are referring to my pages then the answer is "not that I know of". That's not to say there aren't.

The darlington is made from two transistors, that is the way to do it. Together they are then treated like a normal transistor. Or do you mean the physical layout of the schematic? It could be the different pin out you have on your transistor that is throwing you. Top to bottom, mine go collector, base, emitter.

The break on the top strip is there so that you don't have a long unused strip that can only serve to pick up noise. It's not essential but just one of those 'extra quality' things.

Hi Grumpy Mike Let me start by saying I am new!!! But yes, I was referring to the physical layout portion of your page. It looks to me, like the darlington aren't wired up like the schematic? I only ask, because I am new...and don't won't to ruin anything. If you could confirm that it is correct or wrong, I would appreciate it...so I know if my thinking is right or wrong :) But, what you have made is exactly the kind of project I am working on, so it is of great help. I have just starting learning about this, but I love the Arduino! Thanks for any help or input Mark

Physical layouts are a lot harder to debug than schematics but I am quite sure it is OK. Start by labelling the transistors on the schematic T1, the right hand one whose emitter goes to ground and T2, the left hand one whose emitter goes into the base of T2.

Now on the physical layout locate T1, this is on the left and T2 this is on the right.

this is the sort of think that should go on in your head as you look at it.:- So trace it and check the schematic and layout agree. 1) Emitter of T1 to ground - check (schematic) - check (layout) 2) Base of T1 to emitter of T2 - check - check 3) Collector of T1 to collector of T2 - check - check 4) Base of T2 to junction of R1 and detector - check - through a link wire to R1 & detector - check.

So as far as I can see it is correct.