Asked
— Edited
Has anybody used, or know if these can be used with the EZ-B v4? And if do, how do they connect? These flex/bend sensors would be great if they worked with the EZ-B and EZ-Builder. Not much information on power, but they can be used on analog or digital (although I think analog would be better).
Flex / bend sensors
These apparently work with Arduino, so they should work with an EZ-B.
I think you just connect between signal and ground with a resistor on the signal side but not completely sure.
@jeramie? Are you reading this?
Alan
Not sure why you would want to use it as a crash sensor, though... This is cheaper and has a built in pull up resistor to make it plug and play to the ezb's digital ports...Crash Sensor
I was thinking of using these to put inside of K-9's side bumpers. The front ping sensor works well for front object avoidence, but there has been a couple of times where when he takes a corner turning in to another room, as he turns he sometimes hits his side panel on the doorframe, and has cracked one side of the blue acrylic panel.
Although a good idea of using the micro switches Richard, I would have to use a row of them (maybe 5 or 6 per side), but using these flex strips I would only need one per side that could monitor the whole length of the bumper. That's the idea anyway.
In both discriptions, it assumes using a 5v Arduino analog connection so I was thinking what Richard said about it not needing a resistor on the v4's 3.3v signal pins. You can see why I'm a little confused. I have ordered 3 of them so I guess a little testing will be called for.
If you want to use this sensor you should really read some tutorials and reviews on how people are using them and about any problems they are having. I'm sure Richard R has good intention with his advice but I think is a bit off. If you go to Sparkfun they always have good feedback and real use advice on the products they sell. I was looking over a tutorial there on this sensor and they recommend using a resistor and give a good explanation of why. It looks like you will need to feed the sensor 5vdc through a Pull Up resistor and tie it in between the top pin of the sensor and the ADC sensor pin of EZB. The bottom pin of the sensor goes to ground. Here's a short sample of that tutorial:
Code:
Here's how to hook it up to the ADC port of an Arduino useing a Pull Down risistor but it's the same on the EZB:
So go over there and read all about using this sensor. There's lots of information. Here's some links to make it easy for you. Make sure to read all the reviews. Thats where you're going to find most of the practical information on how to use this sensor and how to avoid or overcome any problems.:
www.sparkfun.com/products/8606
www.sparkfun.com/tutorials/270
Datasheet
Here's a tutorial on how to hook it up to the ADC port of an Arduino useing a Pull Down resistor but it's the same on the EZB:
Tutorial on hooking up to an Arduino
Have fun, Dave
Thanks again.
Yes, I'm also looking forward to seeing how this works for you also. There are lots of uses for these. I've read that the readings from them are a bit hard to read if you use them for linear readings. Seems they read slowly at first and then when they get to the last 20% of the bend they really take off.
Readings from the ADC ports on the EZB do float badly. I'm using all of mine as an on/off (high/low) switch so it's not an issue with me. I've been wanting to add a pull up resistor to one just to see how well it stabilizes it.
Using an ADC reader set at 100ms update time, I first tried wiring one up just using signal and ground pins on an analog port. With the sensor flat, the noise reading fluctuated quite a bit between 0 and 7, and bending the sensors didn't make any difference.
I then tried the way that was documented on the website using a 10k pull up resistor (as they recommended). I ran the Vcc through a 5v regulator to a digital pin, and tied in the 10k between the ground and signal wires and ran them to the ground and signal pins on an analog port. It reduced the noise (readings between 0 and 4, mostly between 0 and 2), but flexing the sensor made little to no difference whatsoever.
So unless anyone has any other ideas, I think I just blew $60 (3 sensors, shipping, import tax) on something I can't use. So I might look in to one of the ideas Richard or Dave mentioned. Kinda sucks though, not just for the waste of cash, but these would have been ideal with easy fitting to the bumpers. *mad*
Reading the specs it looks like the resistance changes from 10kohm to 20kohm when flexed. So initially if you are using a 10kohm pullup you should see a value of 1.65V on the ADC port and when flexed the voltage should go up to ~2.5V.
Please check if your solder joints are good on the sensor itself or double check if the correct ADC port is selected.
Thanks for the reply. I can confirm that the solder points are clean and well attached using a solder/flux mix (which I use elsewhere with good results). And I defiantly had the correct port selected from the config menu. The only voltage it was reading was flutuating between 0 and 0.2v at the most when either flexed or straight. I even tried different ADC ports just to be sure. I can try using the 10k on 3.3, but the documentation was using an Arduino on 5v on their example so I would have expected it to work.
Another idea I tried for my robot Questor was using pieces of a metal measuring tape. It seemed to work fairly well but I never got around to actually installing it before I took Questor apart. What was nice was that it makes contact no matter where it is pressed along its entire length. The spring steel and specific shape of the tape measure allows it to spring back to normal after the robot moves away from the object it came into contact with. See post # 17
Thanks for the advice Jeremie and Dave. I tried hooking up the sensor again using Jeremie's idea of not using the regulator, and running all the wires straight off a 3.3 analog port with the 10k. No change.
Then I tried Dave's idea of swapping the wires around which made a very slight difference as the noise values were reduced between 0 and 2, so bending the strip changed the value to around 4 to 5 briefly, but it was too unstable to use because of the noise fluctuation causing false positives.
Then tried a combination of both Jeremie and Dave's ideas, and the reading shot up to 255. So I added back the 5v regulator on a digital power pin and tried again... SUCCESS. With the sensor strip flat, the reading sat around 185/190. With about a 5 degree bend the value dropped to 170. 20 degree bend, 150... and so on. Definitely a hugh difference and very much usable now. So now to tidy up the wiring and install the strips inside of the foam bumpers.
Thanks for all the advice Alan, Richard, Dave and Jeremie. I'm very grateful for the help. And to rgordon as well for your input. Where were you when I needed you? You could have saved me a few beer tokens :D. Seriously though, I had a look at your thread using the measuring tape idea. That's a pretty cool idea and may try that some time on another project. Thanks for the link.
Cheers everyone.
Steve.
If you have time please do a how to and a video.
I don't mean to be a buzz kill but a flex sensor is essentially just a variable resistor, changing the leads around won't change anything in terms of resistance, remember there are only two leads and resistors aren't polarity sensitive. I can almost guarantee that the flex sensor can work on any voltage regardless if it's 3.3V, 5V, or otherwise.
My theory is that since the flex sensor has crimp connections onto the resistive substrate the plastic may have melted a little during soldering process and provided intermittent contact. After a few more tries it may have made contact again.
If the sensor starts reading really low again, it's likely the this is the case.
No problem. I'll try to knock something up. Great teamwork. High 5's all round.
@Jeremie.
Truth be told, I didn't think the polarity would make a difference either. I was careful when soldering and can't see any visible damage/melted plastic as I had already tinned the wires so the soldering was very quick (there was a warning on the website saying to take care when soldering on to these sensors). I've got another one to do for the other bumper so I'll have another play around with that one and post back. BTW, you're not being a buzz kill dude. Any info you supply is always good and always appreciated.
Maybe you were right (I didn't doubt it for a second). I wired up the second sensor, this time without a regulator, and it worked. I did the same with a third strip I had and it worked too
@Dave.
I took a couple of pics and posted a video demo of the second sensor I just wired up for you. It's pretty straight forward so you'll get this straight away. But if anyone else coming across this who wants to do the same, I wrote a quick tutorial as well. So here's how I did it...
1.) Using a servo extension cable, snip off the male connector and strip the white and red wires. Then tin the ends with solder.
2.) In the middle of the White and black wires, strip back the outer casing to bare the wire, and tin with some solder.
3.) Solder a 10 Kohm pull up resistor to the tinned White and black wires mentioned in step #2.
4.) Carefully and quickly (as has been mentioned in above posts
5.) Add some heat shrink to insulate the solder joins.
6.) Connect the servo wire plug to an ADC port, wires matching the pins.
7.) load up an ADC meter in ARC, set the port the sensor is connected to, and bend away. As mentioned above, you should see a static reading of about 140, then the further the sensor is bent, the lower this value will drop (as seen in video below).
NOTE: For a little added stability, apply a small drop of clear silicone adhesive over the crimp connectors on the flex sensor, as thay are a bit fragile and this will give added strength.
Thank you for sharing your findings and creating a great tutorial!
Hope it helps.
http://www.instructables.com/id/Arduino-Wireless-Animatronic-Hand-1/
I tested it out with the Arduino and it does what I want it to do, I just dont know how to "map" in the script the adc flex sensor input to the real time output of servo control.
My hope is to use ADC 0-4 to control servos on D0-4 repsectively on the EZ-B4. The other issue I am having is using the MPU6050 variables to control servos as well.
I have some ability with circuits and assembly, but I have the programming skills equivalent to just learning that the strings on my shoes keep them on, next year I hope to learn to tie them...
Again I apologize if these question have been answered elsewhere.
1) Add a new EZ-Script control
- Project
- Add Control
- Scripting
- EZ-Script
2) Paste in this code
Code:
*Note: you may have to add a multiplier of sort to the GetADC() for each of the positions to dial in your accuracy. As you may have seen with your Arduino setup, the resister values on the flex sensor determine the accuracy and voltage being returned.
What would the multiplier you speak of look like?
Code:
So literally a mathematical function is in place. I see. Hypothetically I could then use this same concept to acquire and apply reading from a accelerometer for servo control as well?
I will look at the SC32 already in the EZB script and see how that is called for reading when I get time and see if I can figure that out. I am guessing I would need to use the add control function for the MPU6050, then set up a script that tells it to read that (similar to above with the exception that I would use the Hex address X or Y variables) and then assign that variable to a servo...? Am I in the ball park?
I see that the MMA7455 under I2C is already set to control servos in the settings. I will look at that too.
Thank you again