Counting Switch Closures

 
#1

Hello all,
just a quick question and I'm sure it will be simple. what I'm looking for is something to count how many times a switch closes. is there something in ez builder? i want to use a switch to count wheel rotation, kinda like a encoder.

thanks,
airwave1206

#2

Quote:

is there something in ez builder?


No.

Quote:

kinda like a encoder.



1) You will need to add external hardware:
2) add some EZ-Script to handle the external hardware.

#3

Depends what you're attempting to do? Are you wanting to count rotation of a wheel encoder to see how far a robot has driven? Are you trying to move a head or arm a specific number of ticks? There's different solutions for different applications.

1) You could use a hardware interrupt from a dedicated pcb, such as arduino. And connect the Arduino to the ez-b. This is because the EZ-B is already doing a significant amount of i/o processing with video, audio, wifi, servos, etc.. So offloading the counting to an arduino will work great. Send the count data to the

OR

2) If the rotation is slow (i.e. < 2 / second), then you can use an EZ-B v4.x/2 or IoTiny without additional hardware and simply read the digital port. If you have an onboard computer in the robot, this rotation count speed can be increased dramatically by using a USB<->Serial connection to the ez-b

OR

3) Use a third party motor controller with built-in encoder to offload the work, such as a Sabertooth with Kangaroo.

Obviously #2 is the easiest because it doesn't require additional hardware.

#4

thanks everyone for the input.
I've seen the arduino encoder post. DJ, I do have a on board pc and the ezb4 running on usb. I might try option #2. I was just trying something easy.
thank you all.

#5

yeah, #2 will work great for you with USB. Like i said, a slow count with #2 can work over WiFi. However, with wifi there is unpredictable delay/latency that is acute to the wireless properties and interference. With USB, it is direct and super fast.