![]() |
IR Board Programming/Wiring Problems
Alright, so our team wired up the IR to digital ins, saw the lights flash on the board. But the outputs we got were very wierd. no matter what we did, it always said command 1,2, and 4 were 0 (being used), and 3 was 1 (not being used). We wired to IR to ground, a 12V supply, and each cmd line to a signal on the microprocessor. In bench testing, this worked fine. We used WPILib and used the default and such and saw the lights on the OI light up along with the board when we hit buttons. Any help with general setup/use using the first four digital inputs would be great.
|
Re: IR Board Programming/Wiring Problems
I have no idea how WPILib does things, but did you make sure you're DIO pins were declared as inputs?
|
Re: IR Board Programming/Wiring Problems
Quote:
Quote:
|
Re: IR Board Programming/Wiring Problems
Quote:
So, this brings up a couple of questions, which Dig. input ports/connectors were your signals attached to? Were those ports declared as inputs? How does your code "latch" in those signals? |
Re: IR Board Programming/Wiring Problems
According to the manual, and tests with microswitches, the input default high, aka backwards from normal
|
Re: IR Board Programming/Wiring Problems
Quote:
A digital input on the RC will be read as a high value, a logic 1, when there is nothing connected to it. An open switch gives a lack of continuity, which is electrically the same thing as nothing. A contact closure to ground will be read as a low value, a logic 0. That's "normal" for the digital inputs. The IR sensor board outputs are not like switches. They are actual logic levels. When an output's associated LED is off, the output is at logic 0. When an output's associated LED is on, the output is at logic 1. That's "normal" for a TTL signal. When you connect the IR board outputs to the RC digital inputs, the values do not somehow change to being "backwards". An inactive signal is still 0, and an active signal is still 1. |
Re: IR Board Programming/Wiring Problems
Back to one of Alan's original questions.
Describe to us the power source and how the power is wired up to your IR receiver. Your description reflects what you'd see if the IR receiver were powered, say from a separate 9v battery or other source that isn't the same source of power that the Robot Controller uses (12v battery). or If command 3 is always high that would probably just be a bad connection. |
Re: IR Board Programming/Wiring Problems
Alright, so we connected the power inputs to a 12v 20 amp supply, just like the RC. on the bench, it worked fine, and default code lit up the switch LEDs on the OI when each was pressed, along with the LED on the IR itself. Now, only the LEDs on the IR light up as they are supposed to. the problem is the RC regonizing the signal. On teh bench, we hooked up only the signal wire the the "white" pin on the RC, and it worked. We never got the chance to test it on the robot itself. We got the code upgrade first thing at comp, and then tested things, which is when we found out it wasn't working.
So, the exact way we hooked up the signals is one pwm for the first three, (one signal per line, put across the three signal pins), and a single signal on another pwm, put in normally, without anything hooked up to the red and black wires. Once again, this setup had been tested on the bench. Maybe we connected to two unused wires, cleaning up the wiring, but even disconnecting these didn't change anything. I'm really confused about the output. I might expect the input wired differently to be different, but input three wass the loner, not four. Also, it doeesn't matter which is which at this point, because they don't change at all. At comp, we got a couple to flicker once and while, but three was always one, and it was always for a very short time before going back to 0,0,1,0 |
Re: IR Board Programming/Wiring Problems
The way this little guy is supposed to be wired is one (IR board) output going to one (RC) input. That means that instead of connecting three wires to one "PWM" cable, you must use four PWM cables and connect each of the outputs to one yellow/white cable.
|
Re: IR Board Programming/Wiring Problems
Quote:
Quote:
|
Re: IR Board Programming/Wiring Problems
Quote:
|
Re: IR Board Programming/Wiring Problems
We saw this kind of behavior when we didn't have a common ground connected to both the IR board and the controller. I.e. we had the IR board powered by a separate battery than the controller, without a connection between the IR board's ground connector and the controller's ground.
|
Re: IR Board Programming/Wiring Problems
Quote:
Just to be sure we're discussing the same connections I'm going to repeat back how you described your wiring in slightly different terms... Using pin 1 on the IR receiver as wire 1, as I understand it you have: - 1 connected to the same 12v+ that the RC is connected to - 3 connected to the same 12v- that the RC is connected to - 5 combined with 6 & 7 in one pwm cable connecting to three signal pins, say digital input 1,2,3 (this wire really corresponds to the third IR button LED) - 6 with 5 above (this wire corresponds to the second IR button LED) - 7 with 5 & 6 above (this wire corresponds to the fourth IR button LED) - 8 is the loner connection, say to digital input 4 (this wire corresponds to the first IR button LED) No other wires are used. I picked digital inputs arbitrarily just to discuss them. You see digital input 3 above staying always at "1"? The momentary change you described before sounds normal. The pins stay high for only 100ms when the IR Receiver passes the signal along. Because it's so quick your code must catch and save the change. To get feedback try using the OI LEDs available to you to watch what the code sees (but be sure to turn off code elsewhere that may be changing the OI lights), e.g., Code:
static char command1=0, command2=0,command3=0;For now try ignoring the failing connection and get your code to work with the other three signals. You can go back to the bad connection after you understand the behavior of the other three. A bad connection will always read as "1." A good connection will normally read as "0", with a 100ms pulse at "1" when the IR remote button is pushed. If the button is held down you'll see it alternate between "1" and "0." |
Re: IR Board Programming/Wiring Problems
You will also want to add a line of code surrounding all of this that states if you see multiple inputs from the board simultaneously, it should disregard all input from the board.
Since a disconnected wire results in a "1", and a connected wire that sees a signal results in a "1", the only way to tell the difference is to make sure you see only one signal wire sending a "1". This will protect against a runaway or out of control condition where the IR board is left disconnected and ALL your values return as "1" - nasty things can happen if you don't protect against this. |
Re: IR Board Programming/Wiring Problems
True statement.
I only suggest using something like what I posted to test and debug the inputs, not to actually process commands on the playing field. To debug this problem you want a direct readout on your OI of what signals are working and you want the lights to latch on the brief 100ms signal, so you don't have to hope to see a flicker. If you see one of the lights on without having pushed the corresponding IR remote button then it means your signal wire is disconnected. You can use a printf there as well to accomplish the same thing. The advantage of OI LEDs is you'll immediately see a disconnected signal wire in the pits and on the field without having a laptop hooked up. For competition you'd have to add what Tom suggested, as well as turn off previous commands and OI lights when a new selection is made. Quote:
|
| All times are GMT -5. The time now is 00:58. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi