Object counter « counting box »

Thanks for all these replies.

Now i have 3 questions for you :

  • what is the maximum distance that a ir proximity sensor can detect ?

  • can i mount both ir sensors together to build a break beam sensor (like the picture from dougp) ?

  • what is the added value to have a capacitor ?

Nagaro: - can i mount both ir sensors together to build a break beam sensor (like the picture from dougp) ?

That exact configuration probably will not work. You need to know whether the sensors are modulated. If they are, each sensor is looking for its own light beam and others will be out of sync. You could try a corner cube reflector and a single sensor to make a retro-reflective sensor but I believe you'd have more success - and less fuss - using something made for the purpose. You might have to do some level translation but the sensor will be reliable.

Don't forget, you have to come up with a way to mount whatever you decide on. Commercial offerings are amenable to a wide variety of mounting options.

Some additional reading material.

Nagaro: - what is the maximum distance that a ir proximity sensor can detect ?

Depending on the actual sensor up to a few meters. The one pictured, 10-20 cm or so, but it depends highly on the object, the incident angle and the level of ambient IR.

  • can i mount both ir sensors together to build a break beam sensor (like the picture from dougp) ?

A proximity sensor looks for the presence of an IR signal, a break beam sensor for the absence. If you would place two proximity sensors opposite one another they would not give any signal: when there's no object presence they see the transmitted IR of the opposite emitter, when there's an object they see the reflected IR of their own.

If you want to go the break beam route, get a break beam sensor.

  • what is the added value to have a capacitor ?

Depends on where (both from an electrical and physical standpoint) exactly in your circuit you plan to add one, what value, and maybe even what type of capacitor it is.

Ok, thank you.

I think i have enough info now to start building the project, and come back with a feedback and probably more questions :-)

Good luck! Hope to hear about the result.

My (mostly tongue-in-cheek) suggestion was to add a [u]capacitive[/u] [u]sensor[/u], not a capacitor. That would add a third sensor (probably) capable of sensing a plastic bag sliding by it. While you're at it, you could also try a laser proximity sensor. :)

All types of sensors may be confounded by two or more bags hitting nearly at the same time or sliding down the ramp together. Unless you can somehow guarantee that the bags will be separated by a "large enough" gap, your software will have to be capable of distinguishing between sensor data for one bag and multiple bags.

Yes, you’re right, a capacitive sensor might also work. The good thing is that all your suggestions gave me several potential solutions. I’ll start from mine (proximity sensors), and move to other ones if this one is not good enough.

For the time gap, as it will be launched by people using this box, they are anyway limited physically to a certain speed. And i guess this speed is lower higher than what the arduino can process. But this will be part of the test :-)

See you soon, for more concrete news :-)

A capacitive sensor will NOT detect a plastic bag passing by. Non-conductive materials are generally not detectable by such as sensor.

It may however detect the metal bits in the jewellery, depending on how much metal is in there and how sensitive it is. It also requires a capacitor that is designed to detect proximity, not touch.

wvmarle: A capacitive sensor will NOT detect a plastic bag passing by. Non-conductive materials are generally not detectable by such as sensor.

<>

Capacitive sensors are used for non-contact detection of metallic objects & nonmetallic objects (liquid, plastic, wooden materials and so on).

http://www.fargocontrols.com/sensors/capacitive.html

Of course plastic does affect the electric fields. A little. If there's enough plastic. Covalent bonds in the plastic will help a lot. Thin polyethylene bags? Won't work.

Hi,

I’ve started to build the circuit, and i’m facing the 1st issues i didn’t think about.
With the 7-segment with 3 digits, i’m using 11 pins on the arduino. Then with the 3 buttons (reset, +1, -1), and the ir sensors, it’s minimum 4 pins additionnal (and more if i use more IR sensors…). But the arduino only has 12 pins available.
I was checking on the internet, and i found a way to reduce the amount of pins used for the 7-segments from 11 to 7 pins, using a 7447.

But it would still be ready sharp for amounts of pins.

  • is the 7447 solution good, or is there a most recent way to do it, or easier or cheaper ?

  • is there a way to reduce even more the amount of pins needed, that they all fit on the arduino without any restrictions ?

For information, i’ll be using an Arduino Nano (i don’t have any other), but i guess it will be enough for this.

Thank you,

The MAX7219 display driver is mentioned often here. It's a serial interface requiring only three Arduino I/O pins.

Sounds great. I’ve checked on google, and found a tutorial on how to configure it (plaisirarduino.fr or https://thecustomizewindows.com/2017/11/arduino-max-7219-cng-basic-circuit-led-7-segment-displays/) I just bought on ebay the MAX7219CNG.

I’ll use a 10kOhm resistor, but not yet the 2 capacitors proposed (it seems like it’s only to have a more stable signal, so it will be in phase 2 for all improvements :-) )

Also : i had to buy a new 3-digits 7-segment, as mine was Anode and it seems like the MAX7219CNG only accepts Cathode. Too bad :-(

I’ll try to build the circuit on Fritzing, to document all of this, and also start checking the Arduino code.

Hi,

Attached the Fritzing schematic from this project.
I’ve tried to make it as easy to read as possible.

Can somebody validate it, or tell me what to change/improve ?

Thank you,

It’s a very nice looking drawing but, (sorry) for a circuit of more than a few connections it becomes very difficult for someone not familiar with the thing to decode what they’re seeing. This is because with all the components out there, some with tens of pin connections, it’s nearly impossible to tell just by looking how something is wired up. Most experienced people are used to looking at schematics where the parts’ pins are named & numbered so you can see at a glance what’s connected to what. Here’s an example from Maxim’s site:

max7219 schematic.PNG

This emphasizes the Maxim part but it illustrates the principle. A full schematic would include all connections, with pin names/numbers, for *all *components. Unfortunately this would also mean expanding signals grouped into a single line for brevity like the digit and segment lines in the drawing.

Even a hand-drawn schematic including the pin names/numbers is better in this case than a pictorial and would, IMHO, get more responses and allow people to see more exactly how you’ve made all the connections and so give an informed response.

Yes, it’s more work but it would be a useful experience. Besides, you’ll need a real drawing to work from and to have available for future reference. There are choices of drawing software but I use the free ExpressSCH.

Agreed, totally unreadable. Especially as the MAX7219 and display pinouts are not given. So can't tell whether the connections are correct or not.

No decoupling cap at the MAX7219. That's an issue.

Ahah, i guessed you would answer that it’s unreadable :-)

I’ll try to make a more readable one, following your advices.

Also, i’ll add the 10 uf electrolytic and 0.1uf(100n) ceramic capacitors, as it seems like it’s mandatory to have them.

Would that be ok ?

Thanks,

The 100n one yes - all digital ICs need one. You can also see one in the reference circuits of the datasheet, p.12/13.

The 10u, where did you find this? I don't see an obvious need for it, but that doesn't mean it's not necessary.

Great, thank you. I can even see where to install it :-)

For the second capacitor, i found it there : https://thecustomizewindows.com/2017/11/arduino-max-7219-cng-basic-circuit-led-7-segment-displays/ Honestly, i trust more what you say than any website. So if you say only the one for 100 nm is enough, then i’ll only install this one :-) I need to order it too :-)

I’ll update the Fritzing sketch, but that might take some days. In between, i’ll start with the Arduino code, as now i know exactly which components i use, so i have all ly inputs/outputs.

Trust the manufacturer's data sheet; not what random people (including myself) tell you on the Internet.

Just checked the link - and found one major issue in the image where they have the two capacitors, and that's with the physical layout.

The 100nF should be placed physically as close as possible to the pin. That wire is a pretty bad thing here, it adds stray induction which in turn negates a lot of the effect of that cap. The 100 nF should go between the GND bus and the strip the Vcc pin is connected, when placing it on a breadboard (and even closer when you're using a proper PCB - there are chips that have the GND and Vcc power pins next to one another, soldering a 0805 package on top of those two leads is then the ideal placement).

Adding a 10µF electrolytic capacitor won't hurt, anyway. Just try it out.

If you order components you may consider adding a pack of 20 x 10 values of electrolytic, and 20 x 30 values of ceramics. Something like that. It's just very convenient to have those values on hand even if you end up not using half of them, they're really cheap so it's not much of a financial investment.