Mirko Pavleski
Published

DIY ESP32 Rife Machine with ZAPPER function

Simple and inexpensive way to make such a device, if you have basic knowledge of electronics and microcontrollers.

BeginnerFull instructions provided3 hours1,435
DIY ESP32 Rife Machine with ZAPPER function

Things used in this project

Hardware components

Espressif ESP32 Development Board - Developer Edition
Espressif ESP32 Development Board - Developer Edition
×1
ST7920 chip based LCD Dispaly
×1
General Purpose Transistor NPN
General Purpose Transistor NPN
×1
Pushbutton Switch, Momentary
Pushbutton Switch, Momentary
×3
Linear Regulator (7805)
Linear Regulator (7805)
×1
Resistor 10k ohm
Resistor 10k ohm
×1
Through Hole Resistor, 470 ohm
Through Hole Resistor, 470 ohm
×1
Trimmer Potentiometer, 10 kohm
Trimmer Potentiometer, 10 kohm
×1
9V battery (generic)
9V battery (generic)
×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

C/C++
.
#include <U8g2lib.h>
#include <driver/ledc.h>  // ESP32 PWM library

// U8G2_ST7920_128X64_1_SW_SPI u8g2(U8G2_R0, /* clock=*/ 18, /* data=*/ 23, /* CS=*/ 5, /* reset=*/ 16);
U8G2_ST7920_128X64_F_SW_SPI u8g2(U8G2_R0, /* clock=*/ 18, /* data=*/ 23, /* CS=*/ 5, /* reset=*/ 22); // ESP32
#define DEBOUNCE_DELAY 50 // 50ms debounce time
unsigned long lastDebounceTime1 = 0;
unsigned long lastDebounceTime2 = 0;
unsigned long lastDebounceTime3 = 0;
const int index_choroby = 37;
const char* choroby[index_choroby] = {
  "ZAPPER", "Angina", "Stomachache", "Pain in general", "Headaches", 
  "Infection", "Acute pain", "Back pain 2", "Arthralgia", "Toothache",
  "No appetite", "No taste", "Motion sickness", "Hoarseness", "Dolegl. gastric",
  "Prostate ailments", "Deafness", "Flu", "Hemorrhoids", "Kidney stones", 
  "Cough", "runny nose", "Hair loss", "Hypertension", "Low pressure", 
  "Disease. thyroid gland", "Bad breath", "General herpes", "Epilepsy", "Constipation", 
  "Dizziness"
};

const int liczby[index_choroby * 10] = {
  30000 ,30000 ,30000  ,30000  ,30000  ,0      ,0      ,0      ,0      ,0      , //"ZAPPER"
  787   ,776   ,727    ,690    ,465    ,428    ,660    ,0      ,0      ,0      , //"Angina"
  10000 ,3000  ,95     ,0      ,0      ,0      ,0      ,0      ,0      ,0      , //"Stomachache"
  3000  ,2720  ,95     ,666    ,80     ,40     ,0      ,0      ,0      ,0      , //"Pain in general"
  10000 ,144   ,160    ,520    ,304    ,0      ,0      ,0      ,0      ,0      , //"Headaches"
  3000  ,95    ,880    ,1550   ,802    ,787    ,776    ,727    ,0      ,0      , //"Infection"
  3000  ,95    ,10000  ,1550   ,802    ,880    ,787    ,727    ,690    ,666    , //"Acute pain"
  787   ,784   ,776    ,728    ,727    ,465    ,432    ,0      ,0      ,0      , //"Back pain 2"
  160   ,500   ,1600   ,5000   ,324    ,528    ,0      ,0      ,0      ,0      , //"Arthralgia"
  5170  ,3000  ,2720   ,2489   ,1800   ,1600   ,1550   ,880    ,832    ,666    , //"Toothache" 
  10000 ,465   ,444    ,1865   ,125    ,95     ,72     ,880    ,787    ,727    , //"No appetite"
  10000 ,20    ,0      ,0      ,0      ,0      ,0      ,0      ,0      ,0      , //"No taste"
  10000 ,5000  ,648    ,624    ,600    ,465    ,440    ,648    ,444    ,1865   , //"Motion sickness"
  880   ,760   ,727    ,0      ,0      ,0      ,0      ,0      ,0      ,0      , //"Hoarseness"
  10000 ,1550  ,802    ,880    ,832    ,787    ,727    ,465    ,0      ,0      , //"Dolegl. gastric",
  2050  ,880   ,1550   ,802    ,787    ,727    ,465    ,20     ,0      ,0      , //"Bladder and prostate ailments",
  10000 ,1550  ,880    ,802    ,787    ,727    ,20     ,0      ,0      ,0      , //"Deafness",
  954   ,889   ,841    ,787    ,763    ,753    ,742    ,523    ,513    ,482    , //"Flu",
  4474  ,6117  ,774    ,1550   ,447    ,880    ,802    ,727    ,0      ,0      , //"Hemorrhoids",
  10000 ,444   ,727    ,787    ,880    ,6000   ,3000   ,1552   ,0      ,0      , //"Kidney stones",
  7760  ,7344  ,3702   ,3672   ,1550   ,1500   ,1234   ,776    ,766    ,728    , //"Cough",
  1800  ,1713  ,1550   ,802    ,800    ,880    ,787    ,727    ,444    ,20     , //"runny nose",
  10000 ,5000  ,2720   ,2170   ,1552   ,880    ,800    ,787    ,727    ,465    , //"Hair loss",
  10000 ,3176  ,2112   ,95     ,324    ,528    ,880    ,787    ,727    ,304    , //"Hypertension",
  727   ,787   ,880    ,0      ,0      ,0      ,0      ,0      ,0      ,0      , //"Low pressure",
  16000 ,10000 ,160    ,80     ,35     ,0      ,0      ,0      ,0      ,0      , //"Disease. thyroid gland"
  1550  ,802   ,880    ,787    ,727    ,0      ,0      ,0      ,0      ,0      , //"Bad breath",
  2950  ,1900  ,1577   ,1550   ,1489   ,1488   ,629    ,464    ,450    ,383    , //"General herpes",
  10000 ,880   ,802    ,787    ,727    ,700    ,650    ,600    ,210    ,125    , //"Epilepsy"'
  3176  ,1550  ,880    ,832    ,802    ,787    ,776    ,727    ,444    ,422    , //"Constipation",
  1550  ,880   ,802    ,784    ,787    ,786    ,766    ,522    ,727    ,72       //"Dizziness",
};

byte inPin1 = 15;
byte inPin2 = 2;
byte inPin3 = 4;
int buzzerPin = 14;  // Define your buzzer pin (make sure it's a valid GPIO pin)

byte i, a, b, c, intr;
byte reading, reading1, reading2, reading3;
byte P1, P2;
unsigned long time0, time1, time2, time3;
const char* tytul;
byte ilosc_f;
byte strona;
char f_str[3];
char i_str[3];
char* k_str;
int f_gen;

void setup(void) {
  u8g2.begin();
  Serial.begin(115200);
  pinMode(13, OUTPUT);
  digitalWrite(13, LOW);
  pinMode(inPin1, INPUT_PULLUP);
  pinMode(inPin2, INPUT_PULLUP);
  pinMode(inPin3, INPUT_PULLUP);
  pinMode(buzzerPin, OUTPUT);
  P1 = 0; P2 = 1;
  intr = 0; strona = 0;
}

void loop(void) {
  if (intr == 1) { stuffHappened(); }
  u8g2.firstPage();
  do {
    if (intr == 0) { Intro(); }
    if (intr == 1) { Menu(); }
  } while (u8g2.nextPage());
  if (intr == 0) { delay(1000); intr = 1; }
  delay(20);
}

void Intro(void) { 
  u8g2.setFont(u8g2_font_helvB12_te);
  u8g2.drawStr(8, 20, "Bio resonance");
  u8g2.drawStr(11, 45, "RIFE machine");
  u8g2.setFont(u8g2_font_6x12_te);
  u8g2.drawStr(20, 62, "Click  to start");
  u8g2.setFont(u8g2_font_open_iconic_arrow_1x_t);
  u8g2.drawGlyph(52, 62, 64);
}

void Menu(void) {
  u8g2.setFont(u8g2_font_6x12_te);
  tytul = "  ILLNESS";
  Ramka();
  for (i = strona; i < 6 + strona; i++) {
    if (i <= index_choroby - 1) {
      u8g2.drawStr(10, 20 + 10 * (i - strona), choroby[i]);
    }        
  }
}

void Ramka(void) {
  u8g2.drawFrame(0, 0, 128, 64);
  u8g2.drawBox(0, 0, 128, 10);
  u8g2.setDrawColor(2);
  u8g2.setFontMode(1);
  u8g2.drawStr(30, 8, tytul);
  u8g2.setDrawColor(1);
  u8g2.setFontMode(1);
}

void stuffHappened(void) {
  P1 = 0; P2 = 0;
  do { Dipsw(); } while (P2 == 0);
}

void Dipsw(void) {
  unsigned long currentTime = millis();

  // Read button 1
  reading = digitalRead(inPin1);
  if (reading == LOW && (currentTime - lastDebounceTime1) > DEBOUNCE_DELAY) {
    lastDebounceTime1 = currentTime;
    P1++;
    if (P1 > index_choroby) { P1 = index_choroby; }
    strona = (P1 > 35) ? 35 : (P1 / 5) * 5;
    Wyswietl_kursor();
  }

  // Read button 2
  reading2 = digitalRead(inPin2);
  if (reading2 == LOW && (currentTime - lastDebounceTime2) > DEBOUNCE_DELAY) {
    lastDebounceTime2 = currentTime;
    P1--;
    if (P1 < 1) { P1 = 1; }
    strona = (P1 > 35) ? 35 : (P1 / 5) * 5;
    Wyswietl_kursor();
  }

  // Read button 3
  reading3 = digitalRead(inPin3);
  if (reading3 == LOW && (currentTime - lastDebounceTime3) > DEBOUNCE_DELAY) {
    lastDebounceTime3 = currentTime;
    tytul = choroby[P1 - 1];
    Generuj();
  }
}

void Wyswietl_kursor(void) {
  u8g2.firstPage();
  do {
    u8g2.drawHLine(5, 11 + (P1 - strona) * 10, 118);
    u8g2.drawHLine(5, 2 + (P1 - strona) * 10, 118);
    u8g2.drawVLine(5, 2 + (P1 - strona) * 10, 10);
    u8g2.drawVLine(122, 2 + (P1 - strona) * 10, 10);
    Menu();
  } while (u8g2.nextPage());
}

void Generuj(void) {
  int f;
  f = 0; ilosc_f = 0; k_str = "";
  
  // Count how many frequencies are associated with the illness
  for (i = 0; i < 10; i++) {
    f = liczby[10 * (P1 - 1) + i];
    if (f > 0) ilosc_f++;
  }
  
  // Convert the count of frequencies to a string for display
  strcpy(f_str, u8x8_u8toa(ilosc_f, 2));
  
  // Loop through each frequency and generate the tone for 1 minute
  for (i = 0; i < ilosc_f; i++) {
    f_gen = liczby[10 * (P1 - 1) + i];  // Get the current frequency
    strcpy(i_str, u8x8_u8toa(i + 1, 2)); // Update the index of frequency being played
    
    DisplayRamka();  // Display the frequency information

    // Call the beep function for 1 minute (60000 milliseconds)
    beep(f_gen, 60000);  // Play the frequency for 1 minute

    delay(1000);  // Add a 1-second delay between frequencies
  }
  
  // Show "FINISH" once all frequencies have been played
  k_str = "FINISH";
  DisplayRamka();
}

void beep(int note, int duration) {

  // Channel 0, Frequency set by `note`, 8-bit resolution
  ledcSetup(0, note, 8);

  // Attach the buzzer pin to PWM channel 0
  ledcAttachPin(buzzerPin, 0);

  // Write the duty cycle (128 out of 255 for 50% duty cycle)
  ledcWrite(0, 128);

  delay(duration);  // Hold the note for the desired duration

  // Stop the tone by setting the duty cycle to 0
  ledcWrite(0, 0);
}

void   DisplayRamka() {
  u8g2.firstPage();
  do {
    u8g2.setFont(u8g2_font_6x12_te);           // choosing small fonts
    Ramka();
    u8g2.drawStr(22, 25, "Start of therapy");
    u8g2.drawStr(25, 38, "Time:");
    u8g2.drawStr(58, 38, f_str);
    u8g2.drawStr(75, 38, "min.");
    u8g2.setFont(u8g2_font_helvB14_te);         // choosing large fonts
    if (k_str == "") u8g2.drawStr(55, 58, i_str);
    if (k_str != "") u8g2.drawStr(22, 58, k_str);
  } while (u8g2.nextPage());
}

Credits

Mirko Pavleski
169 projects • 1379 followers
Contact

Comments

Please log in or sign up to comment.