Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

ESP32-Based Smart Weighing Scale with Proximity Sensor and Pneumatic Control

View and Edit Project In Cirkit DesignerImage of ESP32-Based Smart Weighing Scale with Proximity Sensor and Pneumatic Control

Circuit Documentation

Summary

This circuit involves an ESP32 microcontroller interfacing with various components including an HX711 load cell amplifier, a load cell, a two-channel relay, a 12V pneumatic solenoid valve, an E18-D80NK proximity sensor, and a 12V power supply. The ESP32 reads data from the load cell via the HX711 and controls the relay to operate the solenoid valve. Additionally, the ESP32 reads proximity data from the E18-D80NK sensor.

Component List

  1. ESP32

    • Description: A powerful microcontroller with Wi-Fi and Bluetooth capabilities.
    • Pins: EN, VP, VN, D34, D35, D32, D33, D25, D26, D27, D14, D12, D13, GND, VIN, 3V3, D15, D2, D4, RX2, TX2, D5, D18, D19, D21, RX0, TX0, D22, D23, BOOT
  2. Pushbutton

    • Description: A simple pushbutton switch.
    • Pins: Pin 3 (out), Pin 4 (out), Pin 1 (in), Pin 2 (in)
  3. HX711 - Bridge Sensor Interface

    • Description: A precision 24-bit analog-to-digital converter (ADC) designed for weigh scales and industrial control applications.
    • Pins: E+, E-, A-, A+, B-, B+, GND - GROUND, DATA (OUT), SCK - CLOCK (IN), 3.3/3.5V Supply
  4. Load Cell - Red/white/black/green

    • Description: A sensor used to measure weight or force.
    • Pins: E+, A-, E-, A+
  5. GND

    • Description: Ground connection.
    • Pins: GND
  6. Two Channel Relay 5v

    • Description: A relay module that allows control of high voltage devices.
    • Pins: VCC, IN2, IN1, GND, NC2, C2, NO2, NC1, C1, NO1
  7. E18-D80NK

    • Description: An infrared proximity sensor.
    • Pins: VCC, GND, DATA
  8. 12v Pneumatic solenoid valve

    • Description: A valve controlled by a 12V signal to regulate air flow.
    • Pins: VCC, GND
  9. POWER SUPPLY 12V 5AMP

    • Description: A power supply providing 12V DC output.
    • Pins: 220V Positive Pole (AC), 220V Negative Pole (AC), GND, GND (DC), 12V-24V Output (DC)
  10. Modulo 817

    • Description: A module with multiple input and output channels.
    • Pins: IN1, G, IN2, IN3, IN4, UOUT1, UOUT2, UOUT3, UOUT4

Wiring Details

ESP32

HX711 - Bridge Sensor Interface

Load Cell - Red/white/black/green

Two Channel Relay 5v

E18-D80NK

12v Pneumatic solenoid valve

POWER SUPPLY 12V 5AMP

Code Documentation

Code for ESP32 (Instance 1)

/*
     Q0481-Sketch-Calibrar
     AUTOR:   BrincandoComIdeias
     LINK:    https://www.youtube.com/brincandocomideias ; https://cursodearduino.net/
     COMPRE:  https://www.arducore.com.br/
     SKETCH:  Calibrar Balanca com módulo HX711
     DATA:    04/07/2019
*/

// INCLUSÃO DE BIBLIOTECAS
#include <HX711.h>

// DEFINIÇÕES DE PINOS
#define pinDT  33
#define pinSCK  32
#define pinBotao 4

// INSTANCIANDO OBJETOS
HX711 scale;

// DECLARAÇÃO DE VARIÁVEIS
float medida = 0;

void setup() {
  Serial.begin(57600);

  scale.begin(pinDT, pinSCK); // CONFIGURANDO OS PINOS DA BALANÇA
  scale.set_scale(); // LIMPANDO O VALOR DA ESCALA

  delay(2000);
  scale.tare(); // ZERANDO A BALANÇA PARA DESCONSIDERAR A MASSA DA ESTRUTURA

  Serial.println("Balança Zerada");
}

void loop() {

  medida = scale.get_units(5); // SALVANDO NA VARIAVEL O VALOR DA MÉDIA DE 5 MEDIDAS
  Serial.println(medida, 3); // ENVIANDO PARA MONITOR SERIAL A MEDIDA COM 3 CASAS DECIMAIS

  scale.power_down(); // DESLIGANDO O SENSOR
  delay(1000); // AGUARDA 5 SEGUNDOS
  scale.power_up(); // LIGANDO O SENSOR
}

Code for ESP32 (Instance 2)

// Define the digital input pin where the sensor is connected
const int proximitySensorPin = 35;

void setup() {
  // Initialize the proximitySensorPin as an input
  pinMode(proximitySensorPin, INPUT);
  Serial.begin(9600); // Start serial communication at 9600 baud rate
}

void loop() {
  // Read the state of the proximity sensor
  int sensorState = digitalRead(proximitySensorPin);

  // Check if the sensor is detecting an object
  if (sensorState == HIGH) {
    Serial.println("Object Detected");
  } else {
    Serial.println("No Object Detected");
  }

  // Wait for 100 milliseconds before reading again
  delay(100);
}

This documentation provides a comprehensive overview of the circuit, including a summary, detailed component list, wiring details, and documented code for the microcontrollers.