Batching Controller

Hello All,

I have been searching for a little while about ways to accomplish my goal and have found a lot of useful information on this site and others. Figured I would reach out to see if anyone had any input before I actually get started.
First, I must say I haven’t yet touched an Arduino but plan on ordering one as soon as I get feedback on which one to get. I have 20+ years working on scales specifically some of which included automation and system control however most of this was accomplished with specific parts and equipment supplied by a manufacturer.
Now I want to try to make this work myself.
I believe it will be easy to do but again, would like some feedback before I start throwing good money after bad.

Goal:
Control a relay based on weight.
Using a weight scale with a continuous serial output; String looks like:
<G/N>

Where as,
= ASCII: 02 decimal
= Polarity: < space> = Positive,<–> = Negative
= Weight: 7 digits, right-justified, dummy zeroes, decimal point with no leading
zeroes except for leading zero immediately preceding the decimal point. Leading zeroes transmitted as spaces.
= L: pounds, K = kilograms, T = tons, G = grains, = grams, O = ounces,
<G/N> = G: Gross, N = Net
= Status: < space> = valid, I = Invalid, M = Motion, O = Over/under range, Z = COZ
= Terminator: CR LF carriage return and line feed, CR carriage return

Example string could be: 02 1234567LG CR

Would need to look at the 7 characters #5 through #11 and use that number to control the relay based on a setpoint entered into the program.

Basic example operation would be:
Enter Target: 1.00
Press Start: Relay closes, open relay once target is achieved.

It will get slightly more complex later, but for starters that is the goal.

Future additions might be to have the program look at the weight at the beginning, and essentially auto-tare or note the starting reading and add the target to the current reading or look at string for Z or M in character 14 and respond accordingly. Press start, if character 14 is not Z don’t start.
Possibly add additional relays to control conveyors, multiple ingredients, etc…

Yes, I could buy a programmable indicator for around $2000 that could read the serial string and react accordingly but then I don’t get to learn anything nor get the satisfaction of making this work myself (somewhat) and save money at the same time and maybe get automation into the hands of people that otherwise couldn’t afford it.

Most of the scales in use would be used in a “legal for trade” (buying or selling by weight) application so alternative scale options aren’t possible. The idea is to be able to add the Arduino to basic equipment already in operation without having to upgrade everything.

Any help, ideas or suggestions are appreciated.
Thanks!

Oops, I meant to post this in project ideas.

What you describe is well within the Arduino's capabilities. You need to read a serial port and control a relay. Any of the Arduino boards will do it. The Uno is the most common board out there. A relay shield is all you need to go with it, at least as a start.

Is the scale port RS-232, which can be +/-15V? or is it UART, which is 0-5V? The UART signal can interface directly with the Arduino. RS-232 requires an additional interface circuit. The communication is the same for both, only the voltage is different.

I recommend beginners buy from Arduino, Sparkfun or Adafruit. Their products are good quality and they have tutorials for almost every product. Buying from eBay or the Chinese suppliers is a crap shoot and you rarely get documentation. It would be really frustrating to get a board that doesn't work, but since you are new you spend a long long time trying to figure out what you are doing wrong when it was just a bad board. After some experience if you get a board without documentation, it's possible to figure out how to control it, but for a new comer that can be frustrating.

The one part of you description that concerns me is "Enter Target: 1.00". If you are going to have a keyboard then an Arduino is probably not the best solution. A number pad is possible using a switch matrix, but not a USB type of number pad. Simple Up/Down switches to set the amount are even easier.

Thanks for the reply, sdturner

Hmm.. As to UART or not, I am unsure. I will have to contact the manufacturers tomorrow to find out. I recall most times i'm verifying comms with a meter I usually see voltages over 10v. Ideally this would be used with many different types of equipment so I suppose it is possible that I would run into both of them..?.!

So specifying a set part of the string coming in and using that data specifically is possible? Connecting a scale to a computer and running hyperterminal, putty or the like shows the weight straight away, and there are different output formats that remove some of the additional characters if they cause problems.

I found this kit in stock at a local store and looks to have everything I need. Feel free to correct me if I'm wrong or if this is pure junk.. Inland Arduino Compatible Maker Kit with LCD Display

The kit comes includes a single relay board, displays, push-buttons, LED's and much more.

Seeing what was included in this kit made me think it through a bit more.

Assuming it is possible, I would like to do the following;

  • Use 4 push buttons, 1 - Start/Run 2 - Stop/End 3 - increase target 4 - decrease target (I would be ok if this was a potentiometer instead, if that is better in any way)

  • Add the display to set the target and identify when it is running

Unless It's suggested I do not, I will probably go pick this up tomorrow.

UART is Universal Asynchronous Receiver/Transmitter which is a mouthful, but it sets the timing and protocol of the communications link. The Arduino micro has one or more UARTs built in and they can be emulated in software using softwareSerial(). When you see a USB to Serial adapter or cable or a reference to FTDI converter, that is a simple 0-5V converter. RS-232, RS485, LIN, J1708 just have different voltages and levels to work better in noisy environments, but the underlying signal is the same.

I don't think you mentioned which model of scale you plan to use, but if it is a legal commercial scale it probably has RS-232 so you will need an RS-232 shield or converter to connect up to the Arduino TX and RX pins. If it is a "scale" intended for hackers and makers it probably have a 0-5V or 0-3.3V UART signal that can be connected directly to the Arduino pins. Just note that the RX (receive) or the Arduino connects to the TX (transmit) of the scale and vice-versa.

I am not familiar with the kit or the manufacturer, but it looks fine.

You can use switches for increment / decrement or a pot. Either will work depending on your preference. A pot is a little easier because you just read the value and scale it to your output value. Inc/Dec means you need to look for switches changing state and add/subtract to a variable. it's not difficult, just a little more complicated for someone new to all of this.

The examples in Serial Input Basics should provide a basis for reading the data from the scale.

…R

Thanks again for the info!

I just picked up the kit mentioned above along with an extra UNO for WHEN I burn one up… LOL
I looked for RS232 shields there but they didn’t have any. Only USB shields and RS232 to USB converter shields(?)

One of the main scales I am looking to make this work on is a laboratory balance made by Ohaus.
The scale has mini DIN port and uses cables including a USB host, USB device, RS232, Bluetooth and Ethernet. Oddly enough, the RS232 cable is the most expensive, not counting bluetooth. USB device - $87, RS232 $126!! WTF!? Must be a special protocol which has to be converted. No way a Mini DIN to 9 Pin would be $126 bucks!

I am trying to find out from the manufacture if any outputs are UART or not, but thus far no tech I have spoke to has ever heard of it. Sounds to me like that is what is actually handing the serial communication inside the devices which would be a question for the enginerds.

I have been searching to find out about using USB input from the scale into the UNO but am seeing mixed results along with what sounds to be a process more difficult than I care to take on at this moment. I will start looking for RS232 shields. Sparkfun is local to me according to the guy at microcenter. Maybe I can go pick one up!

I’m going to start playing with my new alien toy and see what trouble I can get into with the programming.

Thanks again for all the help.

Thanks Robin2,

I just read it and will need to read it 8-10 more times before all is said and done I'm sure. Lots of good information there. Nice, clean write up as well.

Thanks again.

ScaleGurus: One of the main scales I am looking to make this work on is a laboratory balance made by Ohaus. The scale has mini DIN port and uses cables including a USB host, USB device, RS232, Bluetooth and Ethernet. Oddly enough, the RS232 cable is the most expensive, not counting bluetooth. USB device - $87, RS232 $126!! WTF!? Must be a special protocol which has to be converted. No way a Mini DIN to 9 Pin would be $126 bucks!

I am trying to find out from the manufacture if any outputs are UART or not, but thus far no tech I have spoke to has ever heard of it. Sounds to me like that is what is actually handing the serial communication inside the devices which would be a question for the enginerds.

If it says RS232 and has a DB-9 connector, it is RS232 and you need an interface for the Arduino. It may be possible to get the pinout, but most likely they are bringing out a USB port on the mini-DIN and the cable has an FTDI USB to serial IC and an RS232 transceiver built into it. The extra parts and (probably) lower volume than USB cables, is why it costs more.

You can learn a lot about serial communication from Robin2's posts and just playing with a serial monitor.

Good luck