Asked — Edited

Using Acd For Switch Inputs

I am putting bumper switches on the back of my bot. I am trying to save on Digital ports so my idea was to use resistors and acd input. Here is a very crude drawing for the idea I am talking about. What I am wondering is if it will work as I think?

When a switch is closed the acd will read the resistor and I can use the software to figure out which switch is closed.

What do you think. I just want to make sure i don't let the factory smoke out the the EZ-B. User-inserted image


ARC Pro

Upgrade to ARC Pro

ARC Pro will give you immediate updates and new features needed to unleash your robot's potential!

United Kingdom
#1  

I think it needs more than just 1 resistor for it to detect which switch is closed. Resistors would reduce the current but not the voltage... Please, someone correct me if that is wrong.

I'm thinking you would need to reduce the voltage, so some kind of voltage divider/reducer circuits after each switch.

United Kingdom
#2  

Actually, I think I am wrong... I need to learn to stop coming on here when I should be asleep...

United Kingdom
#3  

User-inserted image

That's how I would do it...

I haven't worked out if SW1 & SW2 closed, SW1 & SW3, SW2 & SW3 and SW1, SW2 & SW3. You may need to use different values if some I haven't worked out work out to the same. It's too late for me to think about the harder ones...

PRO
Synthiam
#4  

The signal needs to be grounded with a resistor, otherwise the pin will float:) and read crazy voltages

#5  

Thanks guys for the help. I'll try it out and let you know how I make out..

#6  

@DJ would it matter what size of resistor I used on the signal to ground I was thinking of around 3K.

#9  

Guys thanks for the help. It worked perfectly. I wired by Rich's wiring diagram and added the resistor that Dave and DJ said to.

Now to the fun part coding and debug.

I'll put my code up in the script section when i get it done.

United Kingdom
#10  

Glad it worked

The script should be pretty straight forward to write and fun. But, and this may have just been my PC but when I run my voltage monitor script and have the visual ADC meters/graphs/values shown in the ARC environment it slowed my PC down a lot. Just the script running is perfectly fine though, so bear that in mind if you find your PC is slowing down.

#11  

Ok Rich. I'll use the graph to get the various reading and then turn it off.

That was one thing I was wondering is if you are using the adc in the script it doesn't mean that you have to have it running on the screen with a Read ADC? You can just use GetADC?

United Kingdom
#12  

Correct, no need for adding any ACD controls in ARC, just use the script to get the value and store it as a $variable, looping (with a delay if needed, I always put in a short delay but with collission detection delays may not be ideal and I don't think they are needed, try it and see). As far as I can see, using both will get the ADC twice as often (once in the script and once in the interface) which is probably why my PC slowed down (it could be because of the PC I used though so you may have no issue with it)

You may be better off using the ADC Value rather than ADC Graph (change the config, default is set to display volts), manually close each switch and check the reading, do it a few times in case there is any slight fluctuation (there shouldn't be but you never know).

Then use Ifs and Elseifs to make it do things depending on which switch is triggered (or depending on the ADC value to be more specific).

My IR Detection script shows how I looped and used the ADC value in IFs to do something if you get stuck. And my Battery Monitor script shows IFs and ELSEIFs to do different things depending on the values.

#13  

That little circuit looks perfect for an EZ-Bit idea.

#14  

I had a huge problem with my computer grinding to a stop when I had too many ADC monitors installed and active. I had over 9 I think monitoring ports on two boards. ARC chocked and froze up. Windows and the computer still was running OK. I posted this problem to this thread:

synthiam.com/Community/Questions/2582

DJ got back to me with this answer:

----_------------------------------

It's the communication channel. If you flood it by having too many requests, the software will suffer. If you are monitoring ADC and using ReadADC() in scripts, then you are executing twice as many communication calls, which affects performance twice as much.

Remember, when the GUI is running a "read" command from the EZ-B, it has to wait until the command is read and the value is returned. The process can only be as fast as the communication channel. You may use the Benchmark Control to view the communication performance on your computer.

To monitor the ADC, do not use a graphical ADC window - instead use the Variable Watcher to view the results of your ReadADC() commands.


In short, you can install all the monitors you want but pause them all using the check box. only run the ones you need and only when you need to.