Fairly new to arduino, so here goes. My goal is to display a readout of a digital protractor via bluetooth to putty on my laptop. As of now I can get a signal displaying 0 but i can't get the actual value being displayed on the digital protractor. I am using an arduino leonardo, bluetooth serial module, and a pro 3600 digital protractor. The coding currently being used is as follows.
int setInput = 12; // digital level input. Needs a voltage input > 2.4 to iniciate an output.
int setOutput = digitalRead(2); // digital level output
void setup (){
Serial1.begin(9600); // start serial communication at 9600bps
pinMode(setInput,OUTPUT);
digitalWrite(setInput,HIGH); // sends 3-4 volts to level to start dato output.
}
void loop() {
Serial1.println(setOutput); // send digital level data via bluetooth to putty
Calling inputs outputs and outputs inputs is very confusing. Name them from the point of view of the processor.
All that code does is to send the same number over and over, you need to read the digital input each time through the loop.
Even then just reading an input pin is not going to read a number from your calipers. What format is your calipers outputting a number in?
Can you post a link to your caliper's data sheet?
Which is very ambiguous, it could mean the signify is inverted or it could mean it is not.
Anyway you need to feed the output of this level into a serial input but you are using the serial I/O to talk to the blue tooth module. Therefore you need to make another serial input using the software serial library.
Then you need to write code that will read the serial input, see the library for examples.
EDIT:-
[color=red][b]STOP[/b][/color]
The output from this unit is -5V to +5V, this will damage your Arduino if you connect it directly up like you have done. It is best to use a pin other that pin 2 as that might be already damaged.
You need to put an RS232 to TTL logic converter board between the level and your Arduino.
lol i apologize, I trying to ask will this send an integer value to the putty program? Or will i still have to create a library for two more serial ports?
9600baud just happens to be the default speed on an HC-06 bluetooth module so maybe you can connect it directly to the protractor through a RS232 converter and save the Leonardo?
But the HC-06 module does not have an RS232 input on it.
darktitan911:
lol i apologize, I trying to ask will this send an integer value to the putty program? Or will i still have to create a library for two more serial ports?
Two?
It allows the digital protractor to talk to the Arduino without damaging it. You will still need a software serial port to listen to what it says.
Would that display the int value of the digital protractor via putty, or would i still need the to use the Leonardo as a translation interface for the character value being transmitted? @
Riva:
True, but it has 3.3V level serial RX & TX so may work with a RS232/TTL converter as I had mentioned.
darktitan911:
Would that display the int value of the digital protractor via putty, or would i still need the to use the Leonardo as a translation interface for the character value being transmitted? @
From the manual that Grumpy attached...
Angle Output Format:
The ASCII angle output may be read by a computer, or may directly drive a printer. Measured
angles cover a full 360 ° range and the readout is between -180.00 ° and +180.00 ° .
Format:
XXX.XX
examples:
124.50
32.70
9.38
– 4.32
– 179.99
The data is in ASCII format so should directly read in Putty.
The protractor seem to need 9V but is it powered from internal battery or external power supply?
I think you should be able to use a voltage regulator to derive 5V from the 9V supply and a RS232/TTL level shifter like this (but without the 9 pin D-SUB) and an HC-05 or HC-06 bluetooth module (like this) and remove the need for the Leonardo by pairing the BT direct to your PC (assuming it has BT).