Notifications
Clear all

Arduino IR Sensor Application- Sorting Golf Balls by Color

21 Posts
5 Users
2 Likes
813 Views
robotBuilder
(@robotbuilder)
Member
Joined: 5 years ago
Posts: 2042
 

@spaghetticallahan 

Your solution seems a little bit complicated?  Is this a assignment project?

The online solutions seem to favour using two servo motors and a color sensor. You could use the color sensor to detect the presence of a ball by having a background color not used by the balls?

https://www.hackster.io/projectsdiy/iot-based-color-sorting-machine-using-esp8266-and-thingspeak-08b8c5

 


   
ReplyQuote
(@davee)
Member
Joined: 3 years ago
Posts: 1643
 

Hi @spaghetticallahan,

   So it seems you have two, unrelated problems, though they both refer to actions at the first gate.

  • Your ball detector cannot detect a black ball -- presumed to be because the reflection from the black ball is too weak to meet threshold. In many refective sensors, it is possible to set the threshold level, but from the little data I saw on the HobbyComponents web site, this one comes with a fixed threshold. It might be possible to disassemble it and modify the circuit, but obviously that implies a fair knowledge and experience, and even then may still fail. Other suggestions of a light source and light detector on opposite sides of the ball, or a microswitch both sound plausible alternatives.
    •  
    • The light source does not need to be a laser, as the distance is very small and the ball is large compared to small LEDs and photodiodes. Just look for an LED with 'modest' radiation and detection angles. This will be less hazardous, easier to power electrically, easier to align, but still give a measure of protection from stray light. Ideally, look for a means to control the sensitivity, so you can adjust for best performance.

e.g. a device with a curve like:

image

 will clearly direct most of its light, or detect light, at angles up to about 20 degrees to the forward direction.

    • I am a bit bemused why you do not also sense the colour of the ball, whilst it is waiting for gate 1 to open, but I guess you have your reasons. I don't know what you are using to measure the colour, but presumably it can sense black balls, as well as the other colours?

 

  • From your text, it sounds like you can successively adjust the gate time to ensure just one ball proceeds, but the code is presently looping back and sensing a second ball at gate 1, so that two balls can pass through gate 1 in quick succession. This sounds more like a program/sequencing issue. Surely you should be able to hold the second ball at gate 1, until the system has successively dispatched the first ball to its final destination.  This is the type of issue that benefits from a timeline or similar definition.
    • Opening a gate for a specified time may not be the most reliable method of releasing just one ball ... but that probably depends on whether the gate timing is affected by temperature, dust, wear, etc. Hopefully such concerns can be disregarded in the short term at least. Two gates, of which no more than 1 can open at any 1 time might be a better long term solution, but even that needs some careful mechanical design to ensure the gate cannot be jammed.

Best wishes, Dave


   
ReplyQuote
Will
 Will
(@will)
Member
Joined: 3 years ago
Posts: 2506
 

Posted by: @spaghetticallahan

@will 

I like this idea.  I think the simplest solution for the multiple ball problem is to move the gates closer together

Well, the absolutely simplest way is to eliminate the second gate and have the ball's colour read when it's stopped at gate 1, thus eliminating gate 2 altogether. It rolls onto a limit switch which tells the processor that there's a ball present and it then shines a bright light on the ball through a hole in the top of the pipe and determines the colour.

If it can't read a colour then it assumes it's a black ball and opens the correct output chute.

 

Anything seems possible when you don't know what you're talking about.


   
ReplyQuote
(@spaghetticallahan)
Member
Joined: 1 year ago
Posts: 12
Topic starter  

Thanks for all the responses.  To address as best I recall;  The reason for 2 gates is to control the flow of the balls, which i will now accomplish by putting the two gates only 1 ball distance apart.  In short, gate one opens, one ball passes through filling the chamber which is exactly one ball size (+.030 clearance), then gate one shuts.  Color sensor reads color of ball in the chamber,  positions stepper motor affixed to ramp to guide ball to correct bin,  then gate 2 opens releasing ball.  

I like the idea of eliminating the 2 gate system altogether.  However,  given my testing, I get more accurate results for ball color if there is no neighboring ball within the color sensing chamber.  This necessitates 2 gates keeping the ball being read isolated.  

Will- just for clarification the color sensor senses black balls fine,  its the IR sensor that doesn't like the black golf balls. 

DaveE- I agree a two gate solution is more reliable in that there may be more than 1 ball in the tube at a time,  a tube which is positioned on an incline,  and therefore susceptible to an accumulation of force by multiple balls. I agree relying on timing alone is likely not the best route.  I'm going to re machine a section of tube to accommodate my aforementioned plan, and incorporate geometry on gate 1 to ensure that the balls (if multiple present) are pushed back up into the tube; and do not jam the gate.  This also removes the reliance on timing of Gate 1, as now whether it opens for 350ms or 10 minutes, there is only room for one ball to proceed to gate 2.  I'm going to explore the option of a light emitter/detector instead of a laser.  Do you have any specific components in mind like you described? 

Also,  I love the idea of the color sensor being used to detect the presence of a ball, eliminating the need for a sensor at all,  however i don't see how this can be accomplished with a 2 gate system.  

I'm making progress in the design over here and I really appreciate all the help.  You all are awesome.

 


   
ReplyQuote
(@davee)
Member
Joined: 3 years ago
Posts: 1643
 

Hi @spaghetticallahan,

 If you are simply building a "ball present" detector, which is looking for the beam to be blocked by a stationery ball, then I wouldn't expect either the LED or the photdiode detector to be particularly critical.

Obviously they need to matched in terms of wavelength range, though LEDs and photdetectors tend to be  rather broadband (unlike lasers), so that should be easy.

And if you check the data sheets, you will find some try to spread light over a wide angle (and photodetector detects over a wide angle), whilst others are narrower angle.I suggest you tend towards devices with norrower angles, as they are morre suited to this type of application. (The wide angle ones are better for things like TV remote controls, so that the user does not need an accurate aim.)

Even the narrow angle ones are still fairly broad (the first one I found was a total spread of about 40 degrees,) so as long as they are roughly pointed at each other, they should be fine.

Both can be cheap devices .. if you have any in your spares box, start by trying them, you  might not need to buy new ones!

I was just trying to provide guidance if you need to buy them. They could be IR or visible, as long as the source and detector are compatible, though try not illuminate your colour sensor!

If you get small devices,then you may be able to mount them directly into the wall of your 'plumbing', meaning that only a small needs to be drilled for each, though of course you will need to route the wires. Perhaps a tiny 3D print?

---

You say "I get more accurate results for ball color if there is no neighboring ball within the color sensing chamber."

Maybe,if you are more careful with mounting the sensor, and/or some sort of screening or light barrier is used, then you could (virtually) eliminate reflected light coming from any ball, other than the one being sensed?

===

Best wishes, Dave


   
ReplyQuote
(@spaghetticallahan)
Member
Joined: 1 year ago
Posts: 12
Topic starter  

@davee 

I have a couple of IR Sensor transmitter kits with a both a transmitter and receiver.  I think they are meant for tv remotes and the like but being crowded towards the ball as they will be,  they might be sufficient.  I indeed do plan on mounting them via 3D printed brackets to the aluminum split clamps i machined.  Between that and the laser option I should be able to get something to work.   In regards to illuminating the color censor,  hopefully the gate geometry along with the ball itself should cover most of the light pollution.  


   
DaveE reacted
ReplyQuote
Page 2 / 2