I'm really having great trouble in using the IR library with multiple IR receivers.
I wanna make an IR beacon that consist of 4 IR receivers (I labeled them as North, East, West South)
I'm making an IR receiver beacon that can process the signal and
can tell which IR receiver the signal comes from.
heres my code. xD
#include <IRremote.h>
int IR_North = 8;
int IR_East = 9;
int IR_West = 10;
int IR_South = 11;
IRrecv IR_N(IR_North);
IRrecv IR_E(IR_East);
IRrecv IR_W(IR_West);
IRrecv IR_S(IR_South);
decode_results N_results;
decode_results E_results;
decode_results W_results;
decode_results S_results;
void setup()
{
Serial.begin(9600);
IR_N.enableIRIn();
IR_E.enableIRIn();
IR_W.enableIRIn();
IR_S.enableIRIn();
}
void loop()
{
if (IR_N.decode(&N_results))
{
Serial.println("NORTH");
Serial.println(N_results.value, HEX);
IR_N.resume();
}
if (IR_E.decode(&E_results))
{
Serial.println("EAST");
Serial.println(E_results.value, HEX);
IR_E.resume();
}
if (IR_W.decode(&W_results))
{
Serial.println("WEST");
Serial.println(W_results.value, HEX);
IR_W.resume();
}
if (IR_S.decode(&S_results))
{
Serial.println("SOUTH");
Serial.println(S_results.value, HEX);
IR_S.resume();
}
}
the image of the result of the code is attached.
it cant figure out where the signal comes from even though i remove all IR receiver modules except for 1.
Help please! XD sorry for my bad english.
If you leave the unused inputs floating they will likely pick up noise from the remaining receiver. Try grounding the unused inputs to see if the spurious results go away.
Start with one receiver and get that working first. Then progress to 2 and so on.
You will receive the same signal on all receivers unless they are 'shaded' from the source. (Hard to achieve in the same room, but not impossible. Also try with sending a weaker IR signal from the emitter and putting some heeat-shring or tubing over teh IR LED could also help minimising reflections etc, by making hte signal more directional.
If you have any receivers disconnected then you will get spurious noise being received. However, you could enable the PULLUP on each IR input pin to avoid that & it could also reduce noise under normal conditions as well.
steinie44:
Looking at the receivers from above, try this.
|
| *
| *
|
-- and | are cardboard + shape between the receivers
are the receivers.
Nice ascii sketch ...needs a hat too.
However, even the tiniest gap will allow IR through, so close the gaps with black tape.
For fun here is an early mock up of what we did with an 8 receiver unit. The covers were modelled using toy/modelling putty (aka play-doh, plasticene or 'marla' in Ireland). Since then we have gone thru several iterations with 3D Printing for better performance using a diffent design, although the ones in the photo work quite well. We plan to release this as part of a range of IR related Kits in the next few months.
Great construction example, Shows an active mind aware of the capabilities of the IR detector..
My take would have to cut the "funnel" off of those crinkly water bottles and paint them with an opaque... Water based paint
for however many light shields were required.. If you retain the caps it's a simple matter to make a hole in the cap big enough to clear the lense or the IR detector, glue the detector to the top of the cap... and using masking tape to cover the last 10 mm of the sensor wires and paint the whole assembly again with a black and IR opaque paint..
Mounting them with hot glue and wiring the devices to a sensor shield with the common 3 pin servo extension cables would be trivial.
I'd also test the paints for both IR transmissivity and reflection.. For a few dollars more plain old ABS tubing and some reducers and end caps might look more professional and might be easier to gain the non reflective properties that the Play Dough has...
The drawback is the playdough is a flour and salt + water mixture that will dry out and possible crack..
The cardboard or 'printed light shield is still a necessity to help prevent crosstalk.. With some black cheese cloth and an outer housing it could look very professional for very little cost as leftover latex paint can usually be had for the asking and the black pigment might well be finely ground charcoal... I would estimate the total cost might be a quid or so... Though oi'm not a brit...
I should think an Euro would be the most for recycled materials...
The plasticene approach was great for proof of concept, takes about a minute per device and is by far the cheapest way to 'play'.
Since then we have designed a custom cover in 3D and are going through the process of finding out the importance of tolerances. Soon we hope to have a custom 'cover' designed to fit tightly on the IR Receiver and the PCB. Unfortunately, we don't have a 3D printer so the 'affordable' turnaround time is quite slow per design iteration (nearly as slow as getting PCBs made).