I saw that someone had copied my colloidal silver maker design and their design was trending at number one when you search for Arduino Colloidal Silver Maker. So I thought I would improve my previous design to use a Nokia 5110 LCD in the design instead of the 1602 LCD. This Nokia display gives five or six lines of display so you can see more information.
I use a computer power AC adapter to power the colloidal silver maker at about 19 VDC. Most people say that 18 to 20 volts is ideal for this application.
This is a picture of the Nokia display. I added the ability to see the current setting as it reduces every time the current exceeds 1ma. What else do you think I should display on the LCD?
Here is the code:
#include <Adafruit_GFX.h>
#include <Adafruit_PCD8544.h>
// Software SPI (slower updates, more flexible pin options):
// pin 7 - Serial clock out (SCLK)
// pin 6 - Serial data out (DIN)
// pin 5 - Data/Command select (D/C)
// pin 4 - LCD chip select (CS)
// pin 3 - LCD reset (RST)
Adafruit_PCD8544 display = Adafruit_PCD8544(7, 6, 5, 4, 3);
// Pins for Colloidal silver maker
int CS1=10;
int CS2=11;
// Pins for stirrer
int Stir=9; // Moved to pin 9!
int Shutdown=0;
// Variables for time
int hours;
int minutes;
int seconds;
long hour = 3600000; // 3600000 milliseconds in an hour
long minute = 60000; // 60000 milliseconds in a minute
long second = 1000; // 1000 milliseconds in a second
float AN1=0.0; // Analog inut 1
float AN2=0.0;
float temp1=0.0;
float temp2=0.0;
float CUR=0.0; // Current in ma
int CurSet=255; // Current Setting
void setup() {
display.begin();
display.setContrast(60); // Default is 50
display.clearDisplay(); // clears the screen and buffer
pinMode (CS1, OUTPUT);
pinMode (CS2, OUTPUT);
pinMode (Stir, OUTPUT);
}
void loop() {
display.setTextSize(1);
display.setTextColor(BLACK);
// Reverse current every 30 minutes
if (Shutdown==0){
analogWrite(Stir, 128); // 1/2 supply voltage
if (minutes<30){
analogWrite(CS1, 0);
analogWrite(CS2, CurSet); }
else{
analogWrite(CS2, 0);
analogWrite(CS1, CurSet); }
}
else{
analogWrite(CS1, 0);
analogWrite(CS2, 0);
analogWrite(Stir, 0); }
temp1=analogRead(A1);
AN1=((temp1*5.0)/1024.0)*4.0;
temp2=analogRead(A2);
AN2=((temp2*5.0)/1024.0)*4.0;
CUR=abs(AN1-AN2);
if (CUR > 1.0) {CurSet--;} // Reduce PWM
display.clearDisplay();
display.setCursor(0,0);
display.print("V1:");
display.print(AN1); // Analog 1
display.setCursor(0,10);
display.print("V2:");
display.print(AN2); // Analog 2
display.setCursor(0,20);
display.print("Cur:");
display.print(CUR); // Current
display.setCursor(0,30);
display.print("CurSet:");
display.print(CurSet); // Current Setting
// print the number of seconds since reset:
long timeNow = millis();
hours = (timeNow) / hour;
minutes = ((timeNow) % hour) / minute ;
seconds = (((timeNow) % hour) % minute) / second;
display.setCursor(0, 40);
display.print("Time:");
display.print(hours);
display.print(":");
display.print(minutes);
display.print(":");
display.print(seconds);
display.display();
if (hours>3){ // Time under 4 hours
Shutdown=1;
}
if (CUR>2.0){ // Current under 2ma
Shutdown=1;
}
delay(500);
}
There was an error in the connections to the L293 motor driver in my earlier version. The VIN of 19-20 volts goes to pin 8. Also the stirrer has been moved to D9 as the Nokia LCD needs D3.
1 comment:
Hi Bob, I like what you are doing.
Do you have a complete schematic by chance?
Why not use the 0.96" OLD next time? I like them a lot.
Thanks Rick
Post a Comment