|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Connecting custom sensor to RC dig I/O
Here's a question for you electrical gurus:
We made a signal sensor that outputs around 2.9 volts until a signal is received at which point the output goes up to around 3.8 volts. We didn't get a chance to hook this up to the RC before ship, but we are wondering what we need to do to make this output work with the digital inputs on the RC. The RC manual says that the input pins expect a 0v or 5v signal, so how do we make our tweener signal work? |
|
#2
|
|||||
|
|||||
|
Re: Connecting custom sensor to RC dig I/O
Dan,
It would seem that hooking this up to an analog input and adding a little software would do nicely. You just need to write some code to check that input. If the input rises above your set point then trigger your desired result. |
|
#3
|
|||
|
|||
|
Re: Connecting custom sensor to RC dig I/O
Quote:
![]() |
|
#4
|
|||
|
|||
|
Re: Connecting custom sensor to RC dig I/O
We too have run in to the same problem. Could you please explain the "the exrtra software!"
-thanks |
|
#5
|
||||
|
||||
|
Re: Connecting custom sensor to RC dig I/O
Quote:
Code:
{
char a;
if (rc_ana02 <= 615)
{
a = 0;
{
else
{
a = 1;
}
}
This just looks at an analog input and assigns a value of 0 to a variable if the input is less than a threshold, otherwise the variable is set to 1. I chose 615 because the analog inputs to the RC are 10 bit, or, 1024 values. 615 is 60% of 1024, the same as 3 volts is 60% of the reference 5 volts. |
|
#6
|
|||
|
|||
|
Re: Connecting custom sensor to RC dig I/O
Yes... As an update on this we put together a gadget that responds to visibile light...uh in light of the IR problems being reported
We tested it per Al's suggestion and it works great in bright ambient light using code similar to what billbo posted although polling the analog port directly gave strange values. We used (for testing) Get_analog_port (port#) from some OLD code that either originated from the default code or Kevin Watson's code. |
|
#7
|
||||
|
||||
|
Re: Connecting custom sensor to RC dig I/O
Quote:
|
|
#8
|
|||
|
|||
|
Re: Connecting custom sensor to RC dig I/O
Well, as suggested in my previous post, we made the visible light sensor to use instead of the IR sensor in hybrid mode. We used 4 sensors spread apart in a diamond pattern on the back of the robot and handed a 2 million candle power flash light to our robocoach. The sensor module would detect whether a light sensor was receiving a signal then pass it along to its respective analog port (as described above). In accordance to the rules, the robot would respond in a repeatable manner to each sensor. We weren't super ambitious as our programmer mentor (not me this year) was reluctant to make use of the full array of sensors we had installed. So in default, our robot attempted to run laps. One light sensor said "continue autonomous", another said "strafe right", third "strafe left", and the last "pause autonomous".
Problems we had: Field lighting was brighter than pit lighting, so we had some trouble adjusting the sensitivity of the sensors. In a few practice matches the robot would begin OK then apparently drive to a slightly brighter portion of the field and begin strafing left and right. By qualifying matches we had the sensitivity adjusted fairly well except for one match. Normally we wanted to start with the robot against the Robocoach fence, but in one match we started against the driver station wall closest to the lane divider line. Evidently light reflected off the diamond plate and hit the strafe left sensor, so our robot promptly violated G22 before the Robocoach was able to give it a pause signal. |
|
#9
|
||||
|
||||
|
Re: Connecting custom sensor to RC dig I/O
That's smart, I didn't even know we were allowed other communication devices between the robocoach and the robot besides the remote control. Thanks for enlightening me, this should open quite a few doors for us during hybrid mode and sorry if I repeated a question, I wasn't sure if I completely understood what you meant.
|
|
#10
|
|||
|
|||
|
Re: Connecting custom sensor to RC dig I/O
As suggested, I would definitely hook it up to an analog port and do the comparison as shown. We tried to use a homemade IR sensor two years ago that had similar on/off voltage ranges and apparently the "off" wasn't off enough for a digital input. The reading from the sensor never changed when connected to the digital port. We ended up not using the sensor as it was a last minute thing and we didn't think to hook it up to an analog port and try it that way.
|
|
#11
|
|||
|
|||
|
Re: Connecting custom sensor to RC dig I/O
If you need the room for an analog i/o or just want to do it a different way, you can use a comparator and calibrate it to cut off on when your signal reaches the higher voltage.
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Dashboard with analog and dig inputs | Andrew Schreiber | National Instruments LabVIEW and Data Acquisition | 1 | 02-13-2006 10:48 PM |
| gear tooth sensor connecting problem | nirty | Electrical | 2 | 01-23-2006 12:17 PM |
| Connecting Switch to RC | Mr. Steve | Control System | 2 | 01-28-2005 10:37 PM |
| Edubot-sensor wiring & connecting | cadets | Electrical | 2 | 01-08-2004 10:01 AM |
| hey Battlecry-goers.. who's up for shin-dig after?! | archiver | 2000 | 0 | 06-23-2002 11:07 PM |