So I see there are many bright people here so I hope someone can help me with the following. I know with arduino u can add a load cell and connect a relais to turn on a motor etc and set a weight and let it fill automatic. Now my idea is I need to have lets say 12 separate load cells filling each separate. If I need 2,5 kg and each is programmed to stop around 500 grams is it possible to let arduino choose 5 load cells when added up come closest to 2,5 kilo. The product is potatoes so you never have exact 500 grams. So I want signal to activate 5 air cilinders to open the correct buckets connected to the load cells. A multiple head weigher is very expensive and I like building things cheap. I'm good in construction but could use little help with the electronic part. Maybe it's not even possible if it isn't let me know too so I can stop this dream.

If you can write the code, Arduino can certainly do the thing. The only limitation is whether or not you can write the code to look at all your weights and pick the combination that gets closest to 2.5kg. I'm betting there is an algorithm published somewhere to do this efficiently.

Is it possible to connect 12 load cells or do I need 12 arduino boards to read each weight ?

jwmaas: If I need 2,5 kg and each is programmed to stop around 500 grams is it possible to let arduino choose 5 load cells when added up come closest to 2,5 kilo. The product is potatoes so you never have exact 500 grams. So I want signal to activate 5 air cilinders to open the correct buckets connected to the load cells.

About how much does each individual potato weigh?

Does it have to be 5 cells that add up to 2500 g? What if it's 4 cells (e.g. something like 650 + 650 + 600 + 600) ?

4 cells is also ok idea is to get as close as possible to correct weight. There is many different weight with potatoes can be 70 grams or over 100. So my idea was lower weight in each bucket giving more choices for combining to get correct weight

jwmaas: Is it possible to connect 12 load cells or do I need 12 arduino boards to read each weight ?

Which Arduino board? It depends on the load cells and how they hook up. Might be a few too many pins for an UNO but a Mega should have no problem with this at all. The UNO could probably do it but might require a bit of creativity.

Delta_G: If you can write the code, Arduino can certainly do the thing. The only limitation is whether or not you can write the code to look at all your weights and pick the combination that gets closest to 2.5kg. I'm betting there is an algorithm published somewhere to do this efficiently.

There may be an algorithm, but the OP wants to perm 5 from 12 (95,040 possible combinations) and find the nearest to his set weight. The calculations will take several seconds to complete. What if the nearest isn't within his margin of error?

The order doesn't matter, so you want combinations not permutations. It's only 792 possibilities.

12! / (7! * 5!)

1,2,3,4,5 == 1,3,5,4,2 It's the same 5 buckets.

Surely I can eliminate some possibilities right off the bat since I know that for each bucket that has more than 500g I need one with less than 500g. So I should be able to divide my set of 12 into the 6 highest and lowest and then I only need to look at 2 from the lowest and 2 from the highest and one more. Would be easier if it were an even number.

That reduces the combos to (6! / (4! * 2!)) *2 *8 = 240 combinations if I'm doing the math right. And if my assumption that the weights in the buckets is evenly distributed around 500g holds.

EDIT: I don't think my math is right. But I'll leave it here in case someone who has had a little less to drink tonight can fix it.

So what should I collect to test this project let's say 3 load cells 3 air cylinders arduino mega what else? If we can get it to work with 3 and set to lower weight making software choose between 2 of the 3 to get correct weight then to go to 12 should be simple right? Looking at the replies I'm sure some of you will be able to help me with software part and others with connecting part

Personally, I would go for a carousel. Twelve sectors, one loading and one unloading mechanism, one weighing platform in one sector and a rotary drive.

Drop a potato into an empty sector, rotate it over the weighing sector while you load the next, when all twelve are filled, continue rotating (one direction only) as you drop and reload only the ones you have chosen.

I have a funny feeling this will even out at one full rotation per selection, but I also have a feeling that certain combinations of potatoes may end up deviating significantly from your 2.5 kg however you did specify the combination closest to the correct weight so there is then no actual "impossible" combination.

That is the process, but haven't figured out the algorithm yet.

jwmaas:
If we can get it to work with 3 and set to lower weight making software choose between 2 of the 3 to get correct weight then to go to 12 should be simple right?

The math involved becomes much more complicated when we go to 12. Itâ€™s simple for Arduino to calculate the weights of all 3 or the possibilities of picking 2 out of 3.

I found this paper last night. Maybe this will give you an idea of the level of mathematics involved.

pdfs.pdf (407 KB)

Delta_G: Surely I can eliminate some possibilities right off the bat since I know that for each bucket that has more than 500g I need one with less than 500g. So I should be able to divide my set of 12 into the 6 highest and lowest and then I only need to look at 2 from the lowest and 2 from the highest and one more. Would be easier if it were an even number.

That reduces the combos to (6! / (4! * 2!)) *2 *8 = 240 combinations if I'm doing the math right. And if my assumption that the weights in the buckets is evenly distributed around 500g holds.

EDIT: I don't think my math is right. But I'll leave it here in case someone who has had a little less to drink tonight can fix it.

I don't think we can assume the weights will be evenly distributed around 500g. It might be if he was weighing out something smaller, like sugar or flour, but potatoes are big heavy lumps and we've no idea of the variability in the weight of individual potatoes and the range of weights in each bucket, apart from the OP's "around 500 grams". We also don't know how that "around 500 grams" is achieved/ measured/guessed and how accurate it is.