CE 4 something Fall 2023
Lab 1 Reverse Engineering Burner Alert - Part 1
Name:
Mason Brady
Email: mrbrady1@fortlewis.edu

Arduino Recreation

Introduction: This is the process of me reverse engineering the Burner Alert system. A small PCB designed to mount onto stove knobs and buzz every so often when the burner is on. In part 1 I am using an arduino uno, arduino buzzer, and an MPU6050 to understand the logic of the circuit before recreating it with other components.

Materials: Stepper Motor, 2x Uno, 2x nRF24, Joystick

Methods: One joystick was wired to the sender arduino analog input.


The first step is to wire the strain gauges to the HX711 as shown in the main diagram on the main tutorial. The oled display is then wired to VDD, GND and the I2C pins on the arduino. If using the PCB just plug the connections into the header pins.
The 3d prints then need to be printed the model can be seen below in Figure 1.

The arduino was then programmed and tuned.
The arduino code can be seen below:

// Calibrating the load cell
#include <Arduino.h>
#include "HX711.h"
#include <Wire.h>
#include <Adafruit_SSD1306.h>
#include <Adafruit_GFX.h>
#include <math.h>

#define OLED_WIDTH 128
#define OLED_HEIGHT 64
#define OLED_ADDR   0x3C
int tear_value = 0;
// HX711 circuit wiring
const int LOADCELL_DOUT_PIN = 5;
const int LOADCELL_SCK_PIN = 4;
int buttonPin = 3;
HX711 scale;
Adafruit_SSD1306 display(OLED_WIDTH, OLED_HEIGHT);
void setup() {
  Serial.begin(115200);
  scale.begin(LOADCELL_DOUT_PIN, LOADCELL_SCK_PIN);
  display.begin(SSD1306_SWITCHCAPVCC, OLED_ADDR);
  display.clearDisplay();
  display.setTextSize(2);
  display.setTextColor(WHITE);
  display.setCursor(0, 0);
  display.println("Welcome");
  display.display();
  Serial.println("Before setting up the scale:");
  Serial.print("read: \t\t");
  Serial.println(scale.read());      // print a raw reading from the ADC

  Serial.print("read average: \t\t");
  Serial.println(scale.read_average(20));   // print the average of 20 readings from the ADC

  Serial.print("get value: \t\t");
  Serial.println(scale.get_value(5));   // print the average of 5 readings from the ADC minus the tare weight (not set yet)

  Serial.print("get units: \t\t");
  Serial.println(scale.get_units(5), 1);  // print the average of 5 readings from the ADC minus tare weight (not set) divided
            // by the SCALE parameter (not set yet)
           
  scale.set_scale(23.0535);
  //scale.set_scale(-471.497);                      // this value is obtained by calibrating the scale with known weights; see the README for details
  scale.tare();               // reset the scale to 0

  Serial.println("After setting up the scale:");

  Serial.print("read: \t\t");
  Serial.println(scale.read());                 // print a raw reading from the ADC

  Serial.print("read average: \t\t");
  Serial.println(scale.read_average(20));       // print the average of 20 readings from the ADC

  Serial.print("get value: \t\t");
  Serial.println(scale.get_value(5));   // print the average of 5 readings from the ADC minus the tare weight, set with tare()

  Serial.print("get units: \t\t");
  Serial.println(scale.get_units(5), 1);        // print the average of 5 readings from the ADC minus tare weight, divided
            // by the SCALE parameter set with set_scale

  Serial.println("Readings:");
}

void loop() {
  scale.power_up(); 
  if (digitalRead(buttonPin) == HIGH){
    Serial.println("Taring");
    display.clearDisplay();
    display.setCursor(0, 0);
    display.setTextSize(3);
    display.println("Taring");
    display.display();
    //My tear broke after finishing the project, this was a quick fix
    tear_value = -scale.get_units(30);
  }
  display.setTextSize(2);
  //Average 30 values for a more accurate reading
  float scale_reading = scale.get_units(30);
  Serial.println(scale_reading);
  //Clear and reset the display
  display.clearDisplay();
  display.setCursor(0, 0);
  //Quick fix adition
  //Print the reading to the scale and update
  display.print(scale_reading + tear_value, 1);
  display.println("g");
  display.display();

  //Restart the scale
  scale.power_down();             // put the ADC in sleep mode
  scale.power_up(); 
}


My 3D print has failed, I am still tuning my 3D printer and the final assembly will be posted below when the PCB arrives:

The breadboard weighing demonstration can be seen below with a 100g weight:

Figure 2. Breadboard scale demo.


Figure 3. Breadboard scale demo taring and OLED.