Beehive Monitor, humidity, temp and weight

Hei

I wonder if any body can help me. I have tried, for a while now to make a beehive monitor with arduino but i have chanced to Particle electron. I want to measure temp, humidity and weight in the beehive. I,m using the DHT 22 and the HX711. But i,m struggling to find a code to use with the hardware. I want to publish the result to “Thingspeak”

Can somebody help me ?

the code i tried to use =

#include "ThingSpeak/ThingSpeak.h"
#include "Adafruit_DHT/Adafruit_DHT.h"

// Sensor type
#define DHTTYPE DHT22    	// DHT 22 (AM2302)

// DHT22 sensor pinout:
// Pin 1 (on the left): +3.3V
// Pin 2: output
// Pin 4 (on the right): GROUND
#define DHT_5V_PIN D1
#define DHT_SENSOR_PIN D2
#define DHT_GROUND_PIN D4

DHT dht(DHT_SENSOR_PIN, DHTTYPE);

/* Thingspeak */
TCPClient client;
unsigned long myChannelNumber = 89137;
const char * myWriteAPIKey = "3D23PQHQIJ3OZXNF";

void setup() {
    // Connect to ThingSpeak
    ThingSpeak.begin(client);

    // Give power to the sensor
    pinMode(DHT_5V_PIN, OUTPUT);
    pinMode(DHT_GROUND_PIN, OUTPUT);
    digitalWrite(DHT_5V_PIN, HIGH);
    digitalWrite(DHT_GROUND_PIN, LOW);

    // Wait for the sensor to stabilize
    delay(1000);

    // Initialize sensor
    dht.begin();

    // Read Sensor
    double temperature = dht.getTempCelcius();
    double humidity = dht.getHumidity();

    // Update the 2 ThingSpeak fields with the new data
    ThingSpeak.setField(1, (float)temperature);
    ThingSpeak.setField(2, (float)humidity);

    // Write the fields that you've set all at once.
    ThingSpeak.writeFields(myChannelNumber, myWriteAPIKey);

    // Give time for the message to reach ThingSpeak
    delay(5000);

    // Sleep for 15 minutes to save battery
    System.sleep(SLEEP_MODE_DEEP, 15 * 60);
}

void loop() {
    // This will run because the system is sleeping
}

I have helped build a beehive monitor and I used these two libraries to talk to the sensors
https://build.particle.io/libs/HX711ADC/0.0.2
https://build.particle.io/libs/PietteTech_DHT/0.0.5

I have not used ThingSpeak, so I won’t be a lot of help.

But in order go get help, you may need to be a bit more precise what exactly your are struggling with.
You got some code for the DHT22, but does it work, what do you expect, what do you get, … ?

2 Likes

Hei, and thanks

I,m strugling to include the readings from the hx711. The code for the dht22 works with thingspeak.

My question is… what code is missing or what do i have to add to include the readings from the hx711 and Publishing this on thingspeak…

Have you had a look at the demo that comes with the library?
https://build.particle.io/libs/HX711ADC/0.0.2/tab/example/HX711Serial.ino