Hello,
I want to create a Wheatstone bridge half bridge using 2 strain gauges of 120 ohms and receive mV/V value through hx711.
I want to receive the value through HX711 and receive the wireless communication value using NRF24L01, so the value is not received.
I wanted to get the real value to use the code below, const char text = “Hello World”; In this part, I don’t know what the const char text means, and I run it.
Getting a strain gage value with hx711 is also worrying that the values are too sharp, but I would like to ask for advice first.
- Is it correct to write hx711 code and nrf24l01 code together in the transmitter? If it is correct, in what order should I receive the value. I
don’t have to try for a few days, so I eagerly post a question like this… Thank you in advance. - how to combine nrf24l01 code and hx711 code to receive strain guage value
The photo below is a code and line connection. Except the variable resistor part there, I connected the HX711 and the half bridge.
hx711 code
#include “HX711.h”
// HX711 circuit wiring
const int LOADCELL_DOUT_PIN = A1;
const int LOADCELL_SCK_PIN = A0;
HX711 scale;
void setup() {
Serial.begin(9600);
scale.begin(LOADCELL_DOUT_PIN, LOADCELL_SCK_PIN);
}
void loop() {
if (scale.is_ready()) {
long reading = scale.read();
Serial.print("HX711 reading: ");
Serial.println(reading);
} else {
Serial.println(“HX711 not found.”);
}
delay(1000);
}
Transmitter
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
RF24 radio(7,8);// Declare CE and CSN to configure nRF24L01 radio on SPI bus.
const byte address[ 6] = “00001”; //You can change the address value to 5 strings, and the transmitter and receiver must have the same address
void setup() {
radio.begin();
radio.openWritingPipe(address); //Set the address of the destination to send data, which is the previously set 5 character string
radio.setPALevel(RF24_PA_MIN); //Set power level for power supply. If they are close to each other, set them to minimum.
//You can set RF24_PA_MIN / RF24_PA_LOW / RF24_PA_HIGH / RF24_PA_MAX, etc. in the order of close distance.
//It is recommended to use bypass capacitors at GND and 3.3V to ensure a stable voltage during operation at high levels (at long distances).
radio.stopListening(); //Set the module as a transmitter
}
void loop() {
const char text = “Hello World”;
radio.write(&text, sizeof(text)); //Send the message to the receiver
delay(1000);
}
Receiver
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
RF24 radio(7,8);// Declare CE and CSN to configure nRF24L01 radio on SPI bus.
const byte address[6] = “00001”; //You can change the address value to 5 strings, and the transmitter and receiver must be the same address.
void setup() {
Serial.begin(9600);
radio.begin();
radio.openReadingPipe(0, address);
radio.setPALevel(RF24_PA_MIN); //Set power level for power supply. If they are close to each other, set them to minimum.
//You can set RF24_PA_MIN / RF24_PA_LOW / RF24_PA_HIGH / RF24_PA_MAX, etc. in the order of close distance.
//It is recommended to use bypass capacitors at GND and 3.3V to have a stable voltage during high level (if the distance is high)
radio.startListening(); //Set the module as a receiver
}
void loop() {
if (radio.available()) {
char text[32] = “”;
radio.read(&text, sizeof(text));
Serial.println(text);
}
}