Welcome to Synthiam!

Program robots using technologies created from industry experts. ARC is our free-to-use robot programming software that makes features like vision recognition, navigation and artificial intelligence easy.

Get Started
Canada
Asked — Edited

Bumper Contact Switch Scripting

What is the best way to add a home made bumper contact sensor/switch as my sonar is not quite enough to avoid certain obstacles,is there a simple script example I could follow for a contact switch?

AI Support Bot
Related Content
Synthiam
#1  
Oh sorry about the profanity that was my cell phone camera getting low battery,I will edit that out.......Now the sound went out of sync but I got rid of the cell phone swearing at least,(it does a Ricky imitation from Trailer park boys)
#2  
You could use Digital_Wait command to monitor a digital port sensor switch

Code:


#depends on how you wired your contact switch... using a pullup or pulldown resistor
:top
Digital_Wait(D12, ON) #waits until D12 is true
#port 12 switch triggered so do something
reverse()
sleep(2000)
stop()
goto(top)
#3  
Great thanks,I will give that a go and see what happens.I will put something together like a spring switch with that script.:)
#4  
So I just want to thank everyone that helped get my Bot working properly,Richard and Rich and specially DJ Sures for inventing this amazing EZ Robot platform,if a dummy like me can build a custom Robot,imagine what all the younger smarter students will be able to make in schools and the Future! The neat thing is I have only just started and have many upgrades to still add on as this Robot will be used in my Paranormal investigating groups where we go investigate old Churches,houses,Graveyards with our paranormal detecting equipment only mine will be all on the Bot! Testing out my own place tonight for EMF energy that could explain some of the weird noises that wake me up in this old Movie Theater I live in,Thanks again everyone!
#5  
Quick question about bump sensors, as I have several bump switches on the feet and hands of one of my older broken robosapien v2's, will try to mount one on each corner on the base of Rad-Bot so Richard you mention I need step up or down resistors? I saw these type of pressure switches online electronic store but these are required to let EZB sense a bump? Sorry this is new stuff for me but I am looking at wire diagrams on how robosapien had them connected to see if I can copy to Rad.Is there any tutorial I can follow on the wiring diagram to EZB? Would these be the ports on the right side of EZB? I want to use 4 of these switches.
#6  
With a standard contact switch you would connect it to any of the 24 digital I/o ports (not the analog ports).

With electronics it helps to think of everything as a circle (that is what I was taught many years ago). So the digital port has 3 pins right, on the EZB, we have the signal or data line, then have positive power and negative ground.

So typically you would connect a contact switch between the signal and ground. With this setup ideally the signal pin would be in a "high" state until the contact switch is closed and the signal now is connected to the ground to make the state "low".

BUT, if you did nothing further this would not work very well, the signal line would just stay low because there is no return path for it to become "high" once the switch is released. So we use a resister to stay in-between the signal line and the positive power line. The resister is usually a 10k value. (I'm not sure if EZ-Robot has a recommended pull up resister value?). This resister "pulls up" the signal line to a contact state of "high" unless it is interrupted by the contact switch pulling the pin "low".

This state change can be read in ARC from the digital input control.

A "pull down" resister would be the reverse configuration where the resister ties the signal pin to the ground and the contact switch goes between the positive and the signal.

Does that make sense?
#7  
Yes thanks that does explain the resistor question very nicely! I am pretty good at repairs and following electronic diagrams but clueless when it comes to any electronic theory. But learning something new every day as robotics is my favorite new hobby!
#8  
Kinda makes me wonder which way is really the right way to use the bumper switch with the EZB /4 module? I mean, either way , you are sending at least 7.4Vdc onto the digital pin as the input (if using the 2cell lipo) if they are 5v tolerant. Would love to get the offical answer from the EZ-robot team that actually designed and built it.....maybe show an offical wiring?
#9   — Edited
Post deleted due to being irrelevant....
#10  
Wow great to see this old thread again! It really reminds me of how much I have learned since then!:D
PRO
Synthiam
#11   — Edited
Use one of the 3.3v pins to provide power to the switch from the ez-b v4 or iotiny
#12  
Ah, that made sense.  just tried it. did the trick. Thanks DJ.