Mirko Pavleski
Published © GPL3+

Simple Arduino Hulda Clark ZAPPER with Timer function

The device presented in this video generates a signal identical to that of the original Zapper, but is made using a microcontroller

BeginnerFull instructions provided2 hours6,252
Simple Arduino Hulda Clark ZAPPER with Timer function

Things used in this project

Hardware components

Arduino Nano R3
Arduino Nano R3
×1
128x64 LCD with ST7920 chip
×1
Active buzzer
×1
Pushbutton Switch, Momentary
Pushbutton Switch, Momentary
×1
Resistor 1k ohm
Resistor 1k ohm
×1
Resistor 220 ohm
Resistor 220 ohm
×1
Trimmer Potentiometer, 10 kohm
Trimmer Potentiometer, 10 kohm
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)
Solder Wire, Lead Free
Solder Wire, Lead Free

Story

Read more

Schematics

Schematic

..

Code

Code

Arduino
.,
//Arduino ZAPPER

#include <Arduino.h>
#include <U8g2lib.h>

//U8G2_ST7565_NHD_C12864_1_4W_SW_SPI u8g2(U8G2_R0, 10, 9, 12, 11, U8X8_PIN_NONE);
//U8G2_SSD1306_128X64_NONAME_2_SW_I2C u8g2 (U8G2_R0, A5, A4);
U8G2_ST7920_128X64_1_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* CS=*/ 10, /* reset=*/ 8);
byte inPin1 = 5; // digital input sw-1
byte outPin1 = 7; // digital output sw-3
byte time_healing = 7; //time healingenia (30kHz generation)
char time_healing_str[3];
byte time_healing1;
byte time_pause = 20; // break time until next healing in min.
byte time_pause1;
char time_pause_str[3];
byte cycle = 4;
char cycle_str[3];
byte interruptPin = 2;
byte ZapperPin = 4;
char* message;

void setup() {
   u8g2.begin();
   pinMode(inPin1, INPUT_PULLUP); //setting the pin as a digital input
   pinMode(outPin1, OUTPUT); //output to the squeak
   pinMode(13, OUTPUT);
   digitalWrite (13, LOW); //turn on LCD backlight
   pinMode(8, OUTPUT);
   digitalWrite (8, LOW); // giving mass to power the LCD
   pinMode(ZapperPin, OUTPUT); //declaration of Zapper output port
   digitalWrite (ZapperPin, LOW);
   Serial.begin(9600);
}

void loop() {
   //waiting for Start
   cycle = 0;
   digitalWrite(inPin1, HIGH);
   do {
     message = "  PRESS START";
     DisplayLCD();
   } while (digitalRead(inPin1) == HIGH);
   //Getting started
   cycle = 3; beep(); Work();
   beep(); Pause();
   cycle = 2; beep(); Work();
   beep(); Pause();
   cycle = 1; beep(); Work();
   beep(); delay(50); beep(); delay(50); beep();
   time_healing1 = 0; time_pause1 = 0;
}

void Work() {
   time_healing1 = time_healing + 1;
   message = "HEALING";
   for (byte j = 1; j <= time_healing; j++) {
     time_healing1--;
     strcpy(time_healing_str, u8x8_u8toa(time_healing1, 2)); // convert healing1 to a string with 2 digits
     DisplayLCD();
     Generate_30kHz();
   }
   time_healing1 = 0;
}

void Pause() { // generate pause
   time_pause1 = time_pause + 1;
   message = "PAUSE";
   byte s, m, th;
   for (th = 0; th < time_pause; th++) {
     time_pause1--;
     strcpy(time_pause_str, u8x8_u8toa(time_pause1, 2)); // convert pause to string with 2 digits
     DisplayLCD();
     for (s = 0; s < 60; s++) {
       delay (1000);
     }
   }
   time_pause1 = 0;
}

void Generate_30kHz() {
   for (byte z = 1; z < 60; z++ ) {
     for (int i = 1; i < 30000; i++) {
       for (byte j = 1; j < 67; j++) {
         PORTD = B00010000;
       }

       for (byte j = 1; j<66; j++) {
         PORTD = B00000000;
       }
     }
   }
}

void beep() {
   digitalWrite(outPin1, HIGH);
   delay(100);
   digitalWrite(outPin1, LOW);
}

void DisplayLCD(){
   strcpy(cycle_str, u8x8_u8toa(cycle, 1)); // convert cycle to string with 1 digit
   u8g2.setFont(u8g2_font_6x12_tr);
   u8g2.firstPage();
   do {
     u8g2.drawBox(0, 0, 128, 10); // draw a black background
     u8g2.setDrawColor(2); // select the writing mode
     u8g2.setFontMode(1); // white on black
     u8g2.drawFrame(0,11,128,53);
     u8g2.drawRFrame(2,13,124,49,10);
     u8g2.drawStr(40, 8, " ZAPPER");
     u8g2.setDrawColor(1); //return to writing mode
     u8g2.setFontMode(1); //black on white
     if (cycle == 0) {u8g2.drawStr(20, 40, message);}
     if (cycle > 0) {
     //if (time_healing1 > 0 or time_pause1 > 0) {
       u8g2.setFont(u8g2_font_6x12_tr);
       u8g2.drawStr(15, 50, message);
       u8g2.drawStr(95, 50, "min.");
       u8g2.setFont(u8g2_font_9x18_tn);
       if (time_pause1 > 0 ) { u8g2.drawStr(70, 50, time_pause_str);}
       if (time_healing1 > 0 ) {u8g2.drawStr(70, 50, time_healing_str);}
       u8g2.drawStr(55, 30, cycle_str);
     }
   } while ( u8g2.nextPage() );
}

Credits

Mirko Pavleski

Mirko Pavleski

150 projects • 1287 followers

Comments