Total Pageviews

Tuesday, September 27, 2016

Measuring AC Main Supply Voltage with Arduino (2)

   In article named Measuring AC Voltage with an AC to AC power adapter from OpenEnergyMonitor I found a interesting solution for measure AC voltage.
   Schematic is
   I use EmonLib library like in article:
   On DSO I see on R1 resistor
and at A2 input of Arduino board (on R4 resistor):
   I use an LED display with 8 digit 7-segment drived by MAX7219 (I present on article namend Modul de afisare cu 8 cifre LED din 7 segmente fiecare controlate de MAX7219
   I use some configuration for LedControl library (dosc at The Arduino LedControl library):
   Test schematic is
   I write main_voltage_emonlib_1.ino sketch and upload in Arduino board:

Measuring AC Main Supply Voltage with Arduino

   If you need to measuring AC main supply voltage with Arduino must made some calculation.
   I use a simple schematic:
   I can directly measure the DC voltage on R1 resistor. I use internal reference from Arduino Uno board (compatible board with ATmega328 microcontroller) so maximum value for U2 can be
U2 = U1*(R1+R2)/R1 = 1.1*(1+22)/1=25.3V
  AC voltage U1 so DC voltage U2 = U1*1.41-Udiode
  If we put value in equation
U1 = (U2+Udiode)/1.41
because I use trafo U0 = k * U1.
  For tests, I use a trafo imprinted 220V/2x12V 200mA but if I measeure voltage from secondary coil
I found 11V when main voltage is 220V, so k = 220/11=20. I use an 1N4007 diode and Udiode=0.65V.
  I use an LED display with 4 digit 7-segment drived by TM1637 (who I present on base blog in article named Afisaj cu 4 cifre controlate de TM1637 si Arduino and sketches are at
   Schematic for display put on Arduino Uno is:
   I write main-voltage_0.ino sketch and upload in Arduino board and I made a movie named main supply voltage measured with Arduino

Monday, September 26, 2016

Home acces using keypad from outside and push button from inside

   I made a system for home acces with delay-off using keypad from outside and push button from inside. I write a sketch for use actuator or solenoid.
   In stand by mode, solenoid (or actuator) is released.
   After I indroduce good code *1234# from keypad actuator is unlocked for 0.7 seconds; about 5 seconds acces is permited, after that actuator is locked for 0.7 seconds. Same cases are when push button from inside.
   If you use solenoid instead actuator, after I introduce good code *1234# from keypad coil solenoid is powered about 5 seconds, after that coil solenoid is released.
   Base test schematic is:
but if you use actuator, schematic is
and if you use solenoid, schematic is
   A comrade, Tommy, made a permanent montage on PCB for actuator:
   I put an alphanumeric LCD1602 display on i2c and an RTC module with DS3231 (or DS1307) and base schematic is:
   If you upload acces_code_keypad_3.ino sketch. in standby mode, on display is hour & date:
and when acces is shared and a open padlock is displayed.
   In movie named door lock acces with code and pushbutton you cand see all I write: