Darn, my hardware store had the 3M tape, so that might not help. I get home and we have a ton of house work to do, so we'll see how much free time I have to work on it.
I slightly tweaked the alignment and got it working. I can pick up a mirror at 15 feet and the 3M reflector tape reliably at 3 feet and most of the time at 4 feet. Now to find a project to do with it.
Thanks for the feedback, Jim. That's great news, since I ordered 75 of them! Only two for you, Boss?
BTW, I use mine in what I consider "light duty". It's on the mobile robot, continuously on for maybe two minutes at a time. Per the S6986 datasheet, the laser duty cycle is 1/16. Yet Philo said he burned one up without the resistor. I wonder how long these little laser pointer modules would work continuously, for instance if you used them for a break-beam burgular alarm.
Obviously lasers represent a danger to your eyes. I added a secondary on/off switch to my bot so I can turn the laser & sensor off when I'm programming, don't need the laser sensor, or if the kids are around. Another approach would be to use the controller to switch it on & off as needed. Perfect application for a little relay.
I'll use that when I make my robot with a high-power green laser to pop black balloons, and use sound feedback to hear the pop and turn the laser off.
Yesterday I made some targets out of my 3M tape, one inch dowels, and a wooden base. I then had my robot scan for the them at different distances. I found that the detection range is noticeably shorter when the robot is moving relative to the target. I imagine that there is a required time at a specific intensity to trigger the sensor.
The 3M tape kinda stinks and I need to buy better tape. But I imagine that increasing the diameter of the target would make the surface slightly flatter and increase the amount of time for the reflection to reach the sensor. Philo used a 40 mm target while my dowels are only 25 mm.
Yes, I notice on my ~3" dia soda cans that it's still mainly the center, more "perpendicular to the laser" area that gets sensed. The quality of the retroreflective tape definitely makes a difference.
Good to hear you're experimenting with these sensors. I want to see what you & others come up with.
Yes, I notice on my ~3" dia soda cans that it's still mainly the center, more "perpendicular to the laser" area that gets sensed. The quality of the retroreflective tape definitely makes a difference.
I tried a moving robot with a Campbell's soup can with some 3M tape, and it had a two foot detection distance. The wooden dowel had an eight inch detection distance, so it looks like diameter makes a big difference. This makes sense because the larger the diameter the longer the reflection will hit the detector.
This took much longer to get done than I expected. The basics were pretty simple, but coupling all the behaviors together was a fair amount of debugging.
' ================================================== ============================
'
' File...... LaserTest.BSE
' Purpose... The robot finds a target using a laser, grabs and moves it
' Author.... Martin Heermance
' E-mail.... mheermance@gmail.com
' Started... 2014 January 31st
' Updated... 2014 March 30th
'
' {$STAMP BS2}
' {$PBASIC 2.5}
' ================================================== ============================
' ------------------------------------------------------------------------------
' Program Description
' ------------------------------------------------------------------------------
' This program can be used with a CBA or Boe-bot with a gripper, laser, and edge
' sensor to find a target and carry it out of the ring.
' ------------------------------------------------------------------------------
' Revision History
' ------------------------------------------------------------------------------
' Pin allocations.
Buzzer PIN 8 ' pin for output sound
Laser PIN 9 ' pin for laser sensor.
Ping PIN 10 ' trigger for SR-04 sensor
Echo PIN 11 ' echo pin for SR-04 sensor.
ServoPal PIN 12 ' Pin for right servo
Alarm PIN 13 ' Pin for the alarm.
Gripper PIN 14 ' Pin for gripper servo
' ------------------------------------------------------------------------------
' Constants
' ------------------------------------------------------------------------------
'--------[Calibration Constants, must be adjusted for your specific robot]------
GripperOpened CON 500 ' PULSOUT pulse width to open gripper servo
GripperClosed CON 960 ' PULSOUT pulse width to close gripper servo
' These values need tweaking for each robot's servos.
SpeedF75L CON 840 ' Fast forward left
SpeedF50L CON 805 ' Med forward left
SpeedF25L CON 775 ' Slow forward left
Speed000L CON 750 ' stop left
SpeedR25L CON 715 ' slow reverse left
SpeedR50L CON 690 ' med reverse left
SpeedR75L CON 650 ' fast reverse left
SpeedF75R CON 650 ' Fast forward right
SpeedF50R CON 690 ' med forward right
SpeedF25R CON 725 ' slow forward right
Speed000R CON 750 ' Stop right
SpeedR25R CON 775 ' slow reverse right
SpeedR50R CON 810 ' med reverse right
SpeedR75R CON 850 ' Fast reverse right
' Standard values from Ping))) example
Trigger CON 5 ' trigger pulse = 10 uS
Scale CON $200 ' raw x 2.00 = uS
RawToIn CON 889 ' 1 / 73.746 (with **)
RawToCm CON 2257 ' 1 / 29.034 (with **)
' Trigger Ping)))
IsHigh CON 1
IsLow CON 0
' This program is so simple it only needs two variables to
' compute and test the distance to the target, and check the
' line sensors.
X VAR Word
QTIS VAR Word ' Holds the current QTI total
Duration VAR Word ' Holds duration value
Calibration VAR Word ' Holds the calibration value
GripState VAR Word ' Holds current gripper pulse
' Execution starts here
Main:
' Pause at start of program to let user set down robot.
FREQOUT Buzzer, 1000, 2500
' Initialize the servoPal
INPUT ServoPal ' Make sure ServoPal isn't being driven.
DO : LOOP UNTIL ServoPal ' Wait for ServoPAL to power up.
LOW ServoPal ' Set pin to an output and hold it low
PAUSE 100 ' for 100mS to reset ServoPAL.
HIGH ServoPal ' Raise the pin.
PAUSE 100
GripState = GripperOpened
GOSUB Halt ' stop robot
DO
GOSUB ReadAllQTIS
Calibration = QTIS
GOSUB FindTarget
GOSUB Forward
GripState = GripperClosed
GOSUB FindEdge
GripState = GripperOpened
GOSUB Backward
GOSUB TurnAround
LOOP
END
FindTarget:
' slowly rotate until the laser target finds target
PULSOUT ServoPal, SpeedF25R
PULSOUT ServoPal, Speed000L
PULSOUT ServoPal, 10
DO
' Each iteration refresh the gripper.
GOSUB PulseGripper
IF (Laser = IsLow) THEN
GOSUB Halt
FREQOUT Buzzer, 1000, 2500
RETURN
ENDIF
LOOP
Forward:
' slowly move forward to the desired distance to the target
PULSOUT ServoPal, SpeedF50R
PULSOUT ServoPal, SpeedF50L
PULSOUT ServoPal, 20
DO
GOSUB PulseGripper
' Exit if we're close to the target
GOSUB PingDistance
IF (X < 3) THEN
GOSUB Halt
RETURN
ENDIF
LOOP
RETURN
Backward:
' slowly move backward from the target to drop it out ofthe ring
PULSOUT ServoPal, SpeedR50R
PULSOUT ServoPal, SpeedR50L
PULSOUT ServoPal, 20
DO
GOSUB PulseGripper
' Exit if we're close to the target
GOSUB PingDistance
IF (X > 6) THEN
GOSUB Halt
RETURN
ENDIF
LOOP
RETURN
TurnAround:
' Wait one pulse cycle just in case someone just pulsed the ServoPal
PAUSE 15
PULSOUT ServoPal, SpeedR75R
PULSOUT ServoPal, SpeedF75L
PULSOUT ServoPal, 600
PAUSE 600
' Fall through to Halt
' Stop moving
Halt:
' Wait one pulse cycle just in case someone just pulsed the ServoPal
PULSOUT ServoPal, Speed000R
PULSOUT ServoPal, Speed000L
PULSOUT ServoPal, 20
RETURN
' Called to refresh the gripper servo.
PulseGripper:
PULSOUT Gripper, GripState
PAUSE 20
RETURN
' PingDistance - reads the distance at the current head angle.
' Inputs:
' Outputs:
' X - distance in inches.
PingDistance:
Ping = IsLow ' make trigger 0-1-0
PULSOUT Ping, Trigger ' activate sensor
PULSIN Echo, IsHigh, X ' measure echo pulse
X = X */ Scale ' convert to uS
X = X / 2 ' remove return trip
X = X ** RawToIn ' convert to inches
RETURN
FindEdge:
' slowly move forward to the edge
PULSOUT ServoPal, SpeedF75R
PULSOUT ServoPal, SpeedF75L
PULSOUT ServoPal, 20
PAUSE 100
DO
GOSUB PulseGripper
GOSUB ReadAllQTIS
' EXIT IF we've crossed the edge
IF (QTIS > (Calibration + 400)) THEN
GOSUB Halt
RETURN
ENDIF
LOOP
RETURN
' Get calibration value for the QTIS
ReadAllQTIS:
QTIS = 0
FOR X = 0 TO 3
GOSUB ReadQTI
QTIS = QTIS + Duration
NEXT
RETURN
' Read a single QTI
ReadQTI:
HIGH X ' Discharge QTI cap
PAUSE 1 ' Wait 1 ms
RCTIME X, 1, Duration ' Read sensor value
RETURN
Thanks! I'm still using the 3M tape which is not good. I think mylar or that tape from eBay would be better, but I wanted to just get something working with what I had on hand. All the concepts and code will work if I have better tape and a bigger ring.
I'm not using a lens for the laser as my module has a built-in lens that works fine. I just keep the laser and sensor close together and it seems to work.
Erco, I haven't used a different laser because I'm certain the problem is the 3M tape. With a mirror I get a fifteen foot range, easy peasy, so I just need better reflector tape. This was still a fun project even with the bad reflector tape. Plus the Boe-bot running around with a laser on it is cool.
I could see many uses for the laser and targets. Cat and mouse robots, or navigation markers all seem possible.
Not sure about that short range. I get 8-10 feet easy, no lens. Did you try a different laser yet?
Jim, didn't you get long range with no lens using the goldmine laser?
Yes I got ~15 feet on flat surface with this reflector. But wrapped around a pill bottle, I do not get the same results. Will try a soda can tonight and report back.
Sure do, in fact I've also been hoarding ElecGoldmine lasers and retroreflective tape. I'll be offering a package of those together on Ebay soon so people can make their own sensor. I'm debating whether or not to get PCBs made for a complete kit.
Sure do, in fact I've also been hoarding ElecGoldmine lasers and retroreflective tape. I'll be offering a package of those together on Ebay soon so people can make their own sensor. I'm debating whether or not to get PCBs made for a complete kit.
You need some?
Yea,
Give me a couple of days.
I'm changing an alternator, and packing the truck for the Boston Expo.
I'm in for of 10 these and 10 on the Solarbotics purchase.
I'm debating whether or not to get PCBs made for a complete kit.
I'm sure you're capable of designing your own board, but if you'd like me to alter the design in post #107, let me know and I can either send you the gerber files or the DipTrace files.
OSH Park is great for small boards but if your board is going to be the size of a laser, you might want to go with one of the inexpensive fab houses like Itead Studio. I don't recall if you've had custom PCBs made? IMO, it's a lot of fun.
I think the 0.05" sockets would work well with the senors. I doubt 0.05" headers are hard to fine, but if needed, I'm sure I could find the source I used again.
I saw your laser sensors in action today at the Boston Expo on Martin's BoeBot. Do you have any more available? I would be delighted with 10, but happy with any number.
Nice to hear the Expo is going well and Martin made it. What kind of laser demo did he do?
Martin did the same demo in Post #137. I gave him a strip of my NAPA DOT reflective tape, and the demo was highly repeatable, much better than the 3M reflector tape.
Comments
http://www.goldmine-elec-products.com/prodinfo.asp?number=G19601
I can say they run fine at 5 volts with the Hamamatsu receiver.
Looks like it has a 91 ohm resistor built on. Cool!
Will let it run over night to see if any smoke lets out.
BTW, I use mine in what I consider "light duty". It's on the mobile robot, continuously on for maybe two minutes at a time. Per the S6986 datasheet, the laser duty cycle is 1/16. Yet Philo said he burned one up without the resistor. I wonder how long these little laser pointer modules would work continuously, for instance if you used them for a break-beam burgular alarm.
Obviously lasers represent a danger to your eyes. I added a secondary on/off switch to my bot so I can turn the laser & sensor off when I'm programming, don't need the laser sensor, or if the kids are around. Another approach would be to use the controller to switch it on & off as needed. Perfect application for a little relay.
I'll use that when I make my robot with a high-power green laser to pop black balloons, and use sound feedback to hear the pop and turn the laser off.
Only two? Well i knew erco would have some in stock if I need them.
And the special already ran out.
Even though the the EG site specs it 3 volt, it is 5 volt tolerant.
Smaller dot than laser pointers.
Connected to sensor, (modulated). 15' with:
http://www.napaonline.com/Catalog/CatalogItemDetail.aspx/Reflective-Conspicuity-Marking-Strips-TruckLite-Red-White/_/R-LIT98104_0218618121
Don't leave me hanging, Jim! 15 feet with ...?
standard circuit and reflective that I linked to.
The 3M tape kinda stinks and I need to buy better tape. But I imagine that increasing the diameter of the target would make the surface slightly flatter and increase the amount of time for the reflection to reach the sensor. Philo used a 40 mm target while my dowels are only 25 mm.
Yes, I notice on my ~3" dia soda cans that it's still mainly the center, more "perpendicular to the laser" area that gets sensed. The quality of the retroreflective tape definitely makes a difference.
Good to hear you're experimenting with these sensors. I want to see what you & others come up with.
I tried a moving robot with a Campbell's soup can with some 3M tape, and it had a two foot detection distance. The wooden dowel had an eight inch detection distance, so it looks like diameter makes a big difference. This makes sense because the larger the diameter the longer the reflection will hit the detector.
Are you still using the 3M tekk 03440 tape? I could not get it to work consistently on a round surface also.
I am stalled on my project trying to source a cheap plastic lens that I can drill a hole to fit the laser into. Dollar store has tuned up nothing.
McMaster may be another place to shop.
Jim
I'm not using a lens for the laser as my module has a built-in lens that works fine. I just keep the laser and sensor close together and it seems to work.
Not sure about that short range. I get 8-10 feet easy, no lens. Did you try a different laser yet?
Jim, didn't you get long range with no lens using the goldmine laser?
I could see many uses for the laser and targets. Cat and mouse robots, or navigation markers all seem possible.
Yes I got ~15 feet on flat surface with this reflector. But wrapped around a pill bottle, I do not get the same results. Will try a soda can tonight and report back.
Wish I can find my camera!
Jim
You need some?
Yea,
Give me a couple of days.
I'm changing an alternator, and packing the truck for the Boston Expo.
I'm in for of 10 these and 10 on the Solarbotics purchase.
Be back Monday.
As Sigmund Freud noted, the alternator must want to change itself.
OK, your my "ten" guy. No rush, your credit's good, Jim.
I'm sure you're capable of designing your own board, but if you'd like me to alter the design in post #107, let me know and I can either send you the gerber files or the DipTrace files.
OSH Park is great for small boards but if your board is going to be the size of a laser, you might want to go with one of the inexpensive fab houses like Itead Studio. I don't recall if you've had custom PCBs made? IMO, it's a lot of fun.
I think the 0.05" sockets would work well with the senors. I doubt 0.05" headers are hard to fine, but if needed, I'm sure I could find the source I used again.
I saw your laser sensors in action today at the Boston Expo on Martin's BoeBot. Do you have any more available? I would be delighted with 10, but happy with any number.
Rich
Please PM me for Paypal info. $7 per sensor plus a buck for mailing.
Nice to hear the Expo is going well and Martin made it. What kind of laser demo did he do?
Martin did the same demo in Post #137. I gave him a strip of my NAPA DOT reflective tape, and the demo was highly repeatable, much better than the 3M reflector tape.
I was impressed with his demo in person.
Thanks again for the better tape. I'm going to see if I can make a few more targets and video tape another demo on the kitchen floor.