Hello, I am fairly new to Arduino and have some questions about a task I am trying to accomplish. My goal is to have a precision scale connected to Arduino via RS232 port/adapter, and I need to be able to read the value the scale is outputting, as well as zero out the scale when need be. I am just curious how the code in Arduino would look for this, I have no idea what the input signal from RS232 looks like, and I have no idea how I would be able to zero out the scale when need be. If the output of the scale is just a voltage, would I be able to use the map function with some calibration to convert the voltage to weight? and if so how would I zero out the scale when need be? I know my knowledge of this is very minimal, so I thank you for your time and patience. Please let me know.
If it's actually RS232 you will need a MAX232 chip to convert the signal to TTL levels the Arduino can use. Check the docs for your scale. It will almost certainly send the weight as text and there will be tare commands you can use to zero the scale.
Me neither.
What scale, make and model?
Do you have any documentation for it?
a7
Have you physically connected your weighing scale with Arduino UNO via the following converter?
I have not, this project is for a class and we are not able to buy the scale which is making things very hard.
The scale is an AD60 trobal precision scale. that is all the information I have sadly,
Thank you, do you know any tutorials/ projects I can look at with some similarities to mine (using the MAX232)
Thank you, I still don't know how to how to send instructions and receive data using the information you linked. would Serial.write(-S, Z, CR, LF) work to zero the scale and Serial.read() to get the weight value? Like I said I know almost nothing about this stuff so I appreciate your patience.
Get an Arduino with MAX323 module and make it talk with a comm device (or itself).
Scale's Instruction Manual...
The RS232 port on the scale will act like a "DCE" because the scale sees itself as the computer/comm equipment and sees your MAXRS232/ARDUINO as a printer (DTE)
The physical connection only wants TX, RX and GND.
Page 32 - data transmission - once you can get data from the scale, this is what the scale is sending. Parsing is not simple, but it will be the essence of you future comms work.
The scale has a TARE button for weighing stuff inside containers.
thank you, so in terms of writing a command that will tare the scale, what would that look like? am I able to just write Serial.write(-S, Z, CR, LF)? I know I may sound like an idiot but again I have absolutely no idea what I'm doing, and I thank you for replying.
This might be worth some time, you are on the right track but maybe a few pesky details.
Have you written any programs at all for the Arduino? What kind of board do you need to use?
Will you have a copy of the scale to test your code with?
You may also be able to test just the hardware by using a terminal program on you PC like PuTTY or CoolTerm and just type your commands directly and it talks back to your terminal window.
a7
Thanks, slowly I'm learning about this stuff. I have written some simple programs with Arduino for a mechatronics class where we controlled motors, ensors and played with PID control, but I never have had to interface with another complicated device or use serial communication. For this project I am using an arduino mega, and sadly will not have the scale to play around with. From what I've learned so far, I should be using the software.serial library, pins 0 and 1 for Rx and TX to the MAX3232 and using the read function for the data being recieved. using the write function to zero the scale is what i have absolutely no idea about, but i will keep researching and try to figure it out. thanks for all your help.
As you are not owning a physical scale, please collect another UNO or MEGA which will be emulated to work as a scale. This pair will allow to interact between themselves almost like a scale (the UNO) and a Computer (the MEGA). As a result, a programmer/user will be able to test/experiment the dialogues as described in the data sheet of the scale.
No. Since you have a MEGA, you can use one of its other real hardware ports and leave RX and TX which are at 0 and 1 free to communicate with a connected PC during development.
This will be very useful!
The second serial port works just like the first one, and your program can be tested during development by connecting the second back to the PC, where you can talk and listen using PuTTY or CoolTerm or your choice of terminal program.
Two ports on two machines and you can get the thing working well before you ever need to have a scale. I envy you. It will be fun. Yes, I have no life.
So during development, you'll have the IDE serial monitor window for errors and stuff, and the PuTTY window to see the stuff that would go between the scale and the mega.
Since you say you'll never have a real scale, @GolamMostafa' makes an excellent suggestion, viz:
Although this might seem to double your work… it might add to but not really double the work, and woulld build confidence and really prove to whomever whatever it is you have to do.
This is what ppl on Earth would do if the were sending astronauts to Mars with a new device to interface to the only existing real Martian whatever, because the thing needs to work up there and there will be no opportunity to find and fix errors... so it would be simulated to a fare-thee-well on Earth.
So yeah, maybe overkill in you circumstances, but a way to deal with having no real scale, or having one that is shared by 20 ppl - a simulated scale can be flashed to a cheap Arduino and everyone can have one to work with.
In a class, it might even be that some work on simulating the scale (advanced students, perhaps) and others work on the (relatively simple you'll see) program that does the original problem solution.
a7
Well I am happy to notice that I solved your problem.
If you have time to expand on that and tell everyone what the solution actually was, or where you ended up, or what happened... please feel free.
If you are en charette and just can't now, please try to remember us and come back and, you know, tell us how it all worked out.
TIA
a7
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.