Hackster is hosting Hackster Holidays, Ep. 7: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Friday!Stream Hackster Holidays, Ep. 7 on Friday!
Sunday RoboticsnuhDyg
Published © GPL3+

Voltage Regulator With Faces

Electronics is fun, testing is fun, let's make it funnier with a Regulator tester with Faces! :)

BeginnerFull instructions provided10 hours697
Voltage Regulator With Faces

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
Rotary Encoder with Push-Button
Rotary Encoder with Push-Button
×1
RGB Backlight LCD - 16x2
Adafruit RGB Backlight LCD - 16x2
×1
LED Strip, 5 m
LED Strip, 5 m
×1
Pogo-a-go-go Solderless GPIO Pogo Pins
Pimoroni Pogo-a-go-go Solderless GPIO Pogo Pins
×1

Hand tools and fabrication machines

ProBUDDY Kits
cubicon single plus 3d printer

Story

Read more

Custom parts and enclosures

Switch Holder

Battery Holder

Face Holder

Montage Plate

Regulator Fixture Bottom

Regulator Fixture Lid

Regulator Fixture Pim Holder

Schematics

Schematic for the regulator tester with faces project

Code

Regulator tester with faces.ino

Arduino
#define ANALOG_IN_PIN A0
#include <EEPROM.h>

#include <LiquidCrystal.h>
LiquidCrystal lcd(12,11,5,4,3,2);

int e;

float voltage=0.0;
float R1 = 82000.0;
float R2 = 18000.0;
float deger=0;
float analog_deger=0;



int CLK = 6;
int DT = 7;
int SW = 8;

int smileface = 9;
int sadface = 10;

int set_voltage;
int counter;
int currentStateCLK;
int lastStateCLK;
unsigned long lastButtonPress=0;
int set_butonu;

void setup()
{
  e = EEPROM.read(0);
  
  lcd.clear();
  lcd.begin(16,2);
 
  Serial.begin(9600);
  pinMode(CLK, INPUT);
  pinMode(DT, INPUT);
  pinMode(SW, INPUT_PULLUP);
  pinMode(smileface, OUTPUT);
  pinMode(sadface, OUTPUT);

  lcd.setCursor(0,0);
  lcd.print("Set Value = ");
  lcd.print(e);
  lcd.setCursor(0,1);
  lcd.print("Change / Confirm");
  delay(3000);
  lcd.clear();
  counter = e;


  }

void loop()
{

 
  currentStateCLK = digitalRead(CLK); 
  // CLK pininde oluan hareketlenmede fazla saymm nlemek iin 
  //sadece 1 durum deiikliine tepki verme
  if (currentStateCLK != lastStateCLK  && currentStateCLK == 1)
  {
 
    //DT pinin durumu CLK pininden farklysa ve saat ynnde evriliyorsa saya  artar.
    if (digitalRead(DT) != currentStateCLK) 
    {
      counter ++; 
    } 
    
    else 
    {
      // Saat yn tersinde azalma
      counter --;   
    }
 

    Serial.print("set ");
    Serial.println(counter);
 }
 
  // son CLK durumunu hatrla
  lastStateCLK = currentStateCLK;
 
  // set deerini oku
  int set_butonu = digitalRead(SW);
 
  //Eer sinyal low ise butona baslmtr.
  if (set_butonu == LOW) 
  {
  
    //eer son low pulse'dan sonra 50 ms gemise 
    //butona baslp braklm ve tekrar baslm demektir
    if (millis() - lastButtonPress > 50) 
    {
      set_voltage = counter;
      
      EEPROM.write(0,set_voltage);
      
      Serial.println("set_voltage=");
      Serial.println(set_voltage);

    }
    
    // son basmay hatrla
    lastButtonPress = millis();
  }

   e = EEPROM.read(0);
   
   delay(1);
  
  analog_deger = analogRead(A0);
  deger = (analog_deger*5.0)/1024.0;
  voltage = deger/(R2/(R1+R2));
  if (voltage<=(e+0.5) && voltage>=(e-0.5) ) 
    {
    digitalWrite(smileface, HIGH);
    digitalWrite(sadface, LOW);
    }    
    else if (voltage >=1 && voltage <=(e-0.5))
    {
      digitalWrite(smileface, LOW);
      digitalWrite(sadface, HIGH);
    }
    else if (voltage >=(e+0.5))
    {
      digitalWrite(smileface, LOW);
      digitalWrite(sadface, HIGH);
    }
    else
    {
    digitalWrite(smileface, LOW);
    digitalWrite(sadface, LOW);
    }
   
 
lcd.setCursor(0,0);
lcd.print("set=");
lcd.print(e);
lcd.setCursor(8,0);
lcd.print("cnt=");
lcd.print(counter);
lcd.setCursor(0,1);
lcd.print("voltage = ");
lcd.print(voltage);





}
  

Credits

Sunday Robotics
2 projects • 7 followers
SUNDAY ROBOTICS is a dynamic, creative and versatile start-up founded in late 2021 to create things that are majestic and revolutionary.
nuh
0 projects • 1 follower
Dyg
0 projects • 1 follower

Comments