Electrochemical Investigations of Electrolyte Solutions With Arduino and Python
by Dima_Panasenko in Workshop > Science
143 Views, 1 Favorites, 0 Comments
Electrochemical Investigations of Electrolyte Solutions With Arduino and Python
Investigation of Electrolyte Solution Conductance Using Arduino and Python. 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.
Supplies
- Arduino Mega 2560
- LCD screen from arduino kit
- 2 electrodes from graphite
- syringe to drop liquid into other
- acetatic acid
- natrium hidroxide
- water
Create Circuit
Connect our board, screen, electrodes into circuit.
Upload Scetch to the Arduino Board
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 App
I 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.
Lauch Web Hosting to Depict Our Data Remotely
I have used the AwardSpace web hosting service to deploy a webpage, process data from Python, and post it online.
I discovered several advantages there compared to other services:
- Price
- Convenience
- Possibilities"
Create Web Page, Set Python
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. I worthed 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
Information 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
Conclusion
Arduino 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