Investigation of Electrolyte Solution Conductance using Arduino and Python. Sorry, it is Chemistry experiment lesson. You might be boring with that.It is well known that electrolyte solutions can conduct electrical current due to the ions present within them. By applying an electrical voltage to the electrodes, we induce an electric current through our circuit, which includes the electrodes, the solution, and the connecting wires.
Connect our board, screen, electrodes into circuit.
Arduino scetch looks like that:
# include <Wire.h>
# include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C
lcd(0x27, 16, 2); // set the LCD address to 0x3F for a 16 chars and 2 line display
int analogPin = 0;
int volts = 1;
int raw = 0;
int V = 0;
float Vin = 3.3;
float Vout = 0;
float R1 = 1000;
float R2 = 0;
float buffer = 0;
float conductivity;
void setup()
{
lcd.init();
lcd.clear();
lcd.backlight();
Serial.begin(9600);
}
void loop()
{
raw = analogRead(analogPin);
if (raw)
{
buffer = raw * Vin;
Vout = (buffer) / 1024.0;
buffer = (Vin / Vout) - 1;
R2 = R1 * buffer;
conductivity = 1 / R2 * 100;
lcd.setCursor(0, 0);
lcd.print("V out: ");
lcd.print(Vout);
lcd.setCursor(0, 1);
lcd.print("Cnd: ");
lcd.print(conductivity, 6);
Serial.print("Cnd: ");
Serial.println(conductivity, 6);
delay(1000);
}
}
Use Python to Create AppI utilized Python's Kivy GUI framework to visualize data in real-time, obtained from an Arduino device. Python processes the data using the PySerial library, converting and storing it in a list, then displaying it within the GUI frame, and finally sending it to a server.
To post data on web from python was chosen back end approach with PHP, which quite easily Python can establish communication with. The web page we build in traditional manner with, html, CSS and JS.
Python requests library can help you send data to PHP script, treat it and publish on web page.
The major problem, which I was encountered here to set communication php-py.
I highly recommend to pay attention to py library requests and small detail which was not mentioned good enough.
it is headers. God damn I spend above 1 week to find out what is going on. It was worth it me to reed everything what was possible in google, as it had been found out the problem was here:
headers = {"Content-Type": "application/json", "charset": "UTF-8"}
such detail as "charset": "UTF-8" made trouble. With out it, or with other ones settings py sent data, but server was getting empty string
It appears on the web
The content of the webpage, as outlined above, illustrates the data transmission sequence from Arduino to Python to PHP to HTML.
On the plot, we observe the conductometric titration of an acetic acid solution with natrium hydroxide. The concentrations are not specified, as the primary objective was to detect the analytical signal, which is the minimum on the curve. This minimum indicates the equivalence point of the neutralization reaction.
You can read in details about it here https://en.wikipedia.org/wiki/Conductometry.
ConclusionArduino platform is powerful base for science and educational process, combining it with other approaches in programming we can expand its possibilities and apply it in different branches of science
the source code you can explore on my github
https://github.com/tech-science-club/Conductivity_of_electrolyte_solution
Comments
Please log in or sign up to comment.