Great! So it’s not your device, so let’s move on
I’ve slightly altered your code and this works for my Photon (running v0.5.0 - 0.4.9 works just the same).
I’m not using a 10k I just plug the sensor directly into the breadboard (D2 Vcc, D3 data, D4 dummy, D5 GND) and power via D2-D5
#include "blynk/blynk.h"
#include "PietteTech_DHT/PietteTech_DHT.h"
const int projector = A3; // Projector 12Vdc trigger
const int fan = D7; // 6" in-line Duct fan, sucking air out
int sensorValue;
int fanStatus;
double httemp;
double hthum;
double voltage;
#define DHTTYPE DHT22 // Type of DHT Sensor
#define DHTPIN D3 // Temp & Humidity Sensor Inside
#define DHT3v3 D2 // Vcc power for DHT22
#define DHTGND D5 // GND for DHT22
void dht_wrapper(); // must be declared before the lib initialization
PietteTech_DHT DHT(DHTPIN, DHTTYPE, dht_wrapper);
#define SERIAL_EN
#define SERIAL_BAUD 115200
char auth[] = "<--- your token --->";
unsigned long currentTime;
unsigned long loopTime;
void dht_wrapper() {
DHT.isrCallback();
}
void setup()
{
Particle.variable("fan" , &fanStatus, INT); // 0.5.0-rc.1 has a regression here, so you need use the old syntax
Particle.variable("temp" , &httemp , DOUBLE);
Particle.variable("voltage" , &voltage , DOUBLE);
Particle.variable("humidity", &hthum , DOUBLE);
//pinMode(projector , INPUT); // <-- not for analogRead() !!!
pinMode(fan , OUTPUT);
pinMode(DHT3v3 , OUTPUT);
pinMode(DHTGND , OUTPUT);
pinMode(DAC , OUTPUT); // <-- use this as analog signal for projector
digitalWrite(DHTGND, LOW); // using two pins for power supply makes wiring very
digitalWrite(DHT3v3, HIGH); // easy on breadboard (just plug four pins into D2,D3,D4,D5 facing outwards)
digitalWrite(fan , LOW);
Blynk.begin(auth);
#ifdef SERIAL_EN
Serial.begin(SERIAL_BAUD);
#endif
}
void loop()
{
currentTime = millis();
if(currentTime - loopTime >= 2000)
{
fanStatus += 10;
fanStatus %= 4096;
analogWrite(DAC, fanStatus); // I'm using A6/DAC as voltage source for A3
sensorValue = analogRead(projector);
voltage = sensorValue * 3.2 / 4095.0;
digitalWrite(fan, LOW);
Serial.printlnf("Projector\t: %.3f Vdc", voltage);
temp();
blynkStuff();
loopTime = currentTime; // Updates loopTime
}
Blynk.run();
}
void temp()
{
digitalWrite(D7, HIGH);
int result = DHT.acquireAndWait();
// **************** INSIDE TEMPERATURE & HUMIDITY ***************
hthum = DHT.getHumidity();
httemp = DHT.getCelsius();
Serial.printlnf("Humidity\t: %.2f %%", hthum);
Serial.printlnf("Temperature\t: %.2f °C", httemp);
digitalWrite(D7, LOW);
return;
}
void blynkStuff()
{
Blynk.virtualWrite(V1, fanStatus );
Blynk.virtualWrite(V2, httemp , 2);
Blynk.virtualWrite(V3, voltage , 3);
Blynk.virtualWrite(V4, hthum , 2);
return;
}