Hi, I am using an Arduino Nano to collect data from different devices, and further plotting with Python. Now I want to plot a potentiometer against a ORP (redox potential) probe. Because I want mV precision from the Redox, I use an EZO ORP Circuit from Atlas Scientific connected to my Rx and Tx of the Nano. The following gives me the precise Redox values printed on my Serial :
Even though no serial print is explicitly code.
However when trying to combine it with the potentiometer through a simple AnalogRead:
int raw = 0;
float Vout = 0;
#include <SoftwareSerial.h>
#define rx 2
#define tx 3 //define what pin tx is going to be
SoftwareSerial mySerial(rx, tx);
void setup() {
Serial.begin(9600);
}
void loop() { // run over and over
char c = mySerial.read();
mySerial.print(c);
raw = analogRead(A0);
Vout = (5.0 / 1023.0) * raw;
Serial.println(Vout);
}
I only get the analog value printed out. Any help on how can I get both of them?
Gave me the values in the serial monitor.
I think I will raise a new topic because I don't think I have posted my question properly. But thanks Anyway.
I use an EZO ORP Circuit from Atlas Scientific connected to my Rx and Tx of the Nano
The only explanation I can think of why your first code prints to serial monitor:
You have swapped RX and TX between the EZO and the nano. Your EZO TX is connected to the Nano TX; the nano TX goes through the USB chip to the PC (and serial monitor).
What is connected to mySerial? Time for a little schematic, I think. Scan/photo of hand-drawn one will do.
OK, you don't even need a sketch to get your signal to the PC, only power to the Nano is sufficient.
The TX of the EZO is connected to the TX1 of the Nano; the TX1 of the Nano is connected to FT232 USB chip and that connects to the PC.
So what do you want to achieve? Where does the mySerial come in.
Did you want to connect the EZO to software serial so you can read it with the nano and next send the data to the PC using the hardware serial (USB, which is basically TX1)? And next also read the potentiometer and send its data to the PC?
Robin2:
The code I posted in Reply #5 (and which I copied from your Original Post) has no code either in setup() or in loop() so it cannot do anything.
The ATLAS is communicating DIRECTLY with the PC.
You have Tx of the ATLAS connected to TX of the 328, No Comms
You have Tx of the ATLAS connected to the RX of the USB interface board, Comms to PC.
sterretje:
Did you want to connect the EZO to software serial so you can read it with the nano and next send the data to the PC using the hardware serial (USB, which is basically TX1)? And next also read the potentiometer and send its data to the PC?
This is meant entirely in a friendly an humorous manner.
English is a weird language. I believe you mean " ... I overlooked your ..." in other words, that you missed the question.
The word "oversaw" means almost the opposite. An "overseer" is the person who watches carefully to ensure the job is done properly.
And just to make matters really confusing "look over" also means almost the opposite of "overlook". "Please look over my program" means please examine it.
Anyway, I think that TomGeorge gave you sufficient ammunition to continue.
Yes! I got sufficient ammo to get through the bumps! but I have finally realized that I cannot go on with the EZO board....
The EZO boards only writes once a second, even I set the BaudRate to 9600, as I also have for my other sensors. And since the way I have in Python of knowing which analog Input is which, is through printing them separated by spaces or lines, then I am pretty messed up to catch the EZO spittings!
I have started another thread trying to make my own EZO, i.e. reading a voltage difference from -1000mV to 1000mV from two electrodes.
Thanks for your help guys, I appreciate it. Also the language constructuctive critics :-p