Notifications
Clear all

ESP-32 and DHT22

46 Posts
5 Users
2 Likes
4,712 Views
Will
 Will
(@will)
Member
Joined: 3 years ago
Posts: 2508
 

@farzad_k 

The analogWrite to the digital pin is used for sending PWM signals to a suitable pin. That's where the PWM range 0-255 is required rather than just a HIGH or LOW signal which would normally be applied to digital pins.

If you need to free up more pins, you cn get an I2C adapter to solder onto your 1602LCD so it will only require +5, GND, and two pins (A4 and A5).

 

 

Anything seems possible when you don't know what you're talking about.


   
ReplyQuote
(@farzad_k)
Member
Joined: 3 years ago
Posts: 75
Topic starter  
Posted by: @will

@farzad_k 

The analogWrite to the digital pin is used for sending PWM signals to a suitable pin. That's where the PWM range 0-255 is required rather than just a HIGH or LOW signal which would normally be applied to digital pins.

If you need to free up more pins, you cn get an I2C adapter to solder onto your 1602LCD so it will only require +5, GND, and two pins (A4 and A5).

 

 

Thanks. I have an I2C board coming along with the display unit already. It would have been good if TinkerCAD had an I2C board to save us from all that wiring.

What is a good source of learning things like you have shed light on about digital versus analog? Are there online classes?

 


   
ReplyQuote
Will
 Will
(@will)
Member
Joined: 3 years ago
Posts: 2508
 

@farzad_k 

The digital versus analog I mentioned above is used when sending PWM signals and only applies to those pins which are capable of PWM output. Which pins they are depends on the Arduino you are using.

You can read more on PWM on the Arduino to get a more complete understanding of what it is and how it's implemented. Just Google for "Arduino PWM project" for more examples.

Anything seems possible when you don't know what you're talking about.


   
ReplyQuote
(@farzad_k)
Member
Joined: 3 years ago
Posts: 75
Topic starter  

@will Thanks, I will.


   
ReplyQuote
(@farzad_k)
Member
Joined: 3 years ago
Posts: 75
Topic starter  

Here is an article on how to calculate dew point.

For simplified cases it proposes: Td = T - ((100 - RH)/5.)

 

Here is an online calculator.

 

Another online resource for calculating dew point.


   
ReplyQuote
Will
 Will
(@will)
Member
Joined: 3 years ago
Posts: 2508
 
Posted by: @farzad_k

Here is an article on how to calculate dew point.

For simplified cases it proposes: Td = T - ((100 - RH)/5.)

Here is an online calculator.

Another online resource for calculating dew point.

Do you plan to use the ESP to connect online and request a dew point temperature ?

By the way, I'd suggest that you also hook up a buzzer to your rig so that you can make an audible alarm when the relative humidity hits 100%. It may signal the end of your viewing for the night.

Anything seems possible when you don't know what you're talking about.


   
ReplyQuote
(@farzad_k)
Member
Joined: 3 years ago
Posts: 75
Topic starter  
Posted by: @will
Posted by: @farzad_k

Here is an article on how to calculate dew point.

For simplified cases it proposes: Td = T - ((100 - RH)/5.)

Here is an online calculator.

Another online resource for calculating dew point.

Do you plan to use the ESP to connect online and request a dew point temperature ?

By the way, I'd suggest that you also hook up a buzzer to your rig so that you can make an audible alarm when the relative humidity hits 100%. It may signal the end of your viewing for the night.

Generally speaking the ideal imaging location is where the skies are the least polluted. This coincides with a lack of all services, but internet can be accessed indirectly. Easiest thing would be to enter the dew point manually, but if it can be approximately calculated using temperature and relative humidity, then it can figure it out provided the sensor returns relative humidity not the humidity.

I don't know how observers do it, really. I have been next to them at star parties and wonder why they do what they do. The see everything in monochrome any way, including the planets. For imagers it is different. We hope to set the system up and let it go to work while we sleep although many stay up, troubleshooting all night.

There is a lot to be carrying to the field, and redundancies as much as practicable are crucial. The less stuff the better, at the same time.

 


   
ReplyQuote
Will
 Will
(@will)
Member
Joined: 3 years ago
Posts: 2508
 

@farzad_k 

If you think that the simple formula will be enough to keep your forming images intact, then go for it.

Have you any initial thoughts on how the software will decide when to start heating, when to increase power, decrease power and stop heating altogether ?

Anything seems possible when you don't know what you're talking about.


   
ReplyQuote
(@farzad_k)
Member
Joined: 3 years ago
Posts: 75
Topic starter  

@will Once the dew point [temperature] (DPT) is calculated using the reported temperature (T) and relative humidity, then the delta between the DPT and T should be calculated at every second.

Tc = current temperature

Tdp = dew point temperature

While Tc is greater than or equal to 1.1 x Tdp (10% higher), do nothing.

When Tc is is equal to or less than 1.1 x Tdp analogwrite to the mosfet pin with a value between 0 and 255. This value needs to be determined somehow, but my initial feeling is how I described it before: divide the range between 0-255 to four segments, each representing a 3v step. Or it can be divided into six ranges of 2v each.

What needs further thinking is consideration that the sensed temperature is of air that is not being heated by the heater. So if at time t1, temperature is measured to be T1 and dew point is calculated to be Dpt1, and if T1 is less than 1.1 x Dpt1, heater will receive 3v and begin heating. Sensor is unaware of it. A short time later, at time t2, temperature drops to T2, RH drops to RH2 and we have a new Dpt2. It is very difficult to trigger a next step without having a probe sitting close to the item we want to keep warm.

This can become complicated. See this document.

 


   
ReplyQuote
Will
 Will
(@will)
Member
Joined: 3 years ago
Posts: 2508
 

@farzad_k 

Could you use a TMP009 or something like it mounted on the body near the heater to measure the temperature of the tube near the lens ? The metal tube would conduct faster than the glass lens but it would still give a better idea of the temperature of the glass. That would allow you to come a lot closer monitoring the effect of the heater.

The DHT22 is capable of taking measurements every 2 seconds which seems too often unless it's windy. I was thinking of taking temp and relative humidity readings and saving them in an array with the calculated dew point temperature. You could then calculate the direction and rate of approach to the dew point temp. Each subsequent reading would push the rest of the results down and the earliest would be removed from the array.

If the approach is slow, then you can apply lower power and leave it to see what happens. You'd ramp up the power each time the dew point came closer to your measured temperature and hold (or even decrease) as the dew point got farther from your temperature.

This could give you a smooth response to the change in temp or humidity and conserve battery power as well.

Anything seems possible when you don't know what you're talking about.


   
ReplyQuote
(@farzad_k)
Member
Joined: 3 years ago
Posts: 75
Topic starter  

@will good idea. I can take a few TMP36 sensors and spread them around the front element retainer of my scope, hook them up in parallel, take the average temperature and use that value to calculate the dew point.

 

 


   
Will reacted
ReplyQuote
Will
 Will
(@will)
Member
Joined: 3 years ago
Posts: 2508
 

@farzad_k 

Excellent, get your data from as close to the protected target as possible !

Anything seems possible when you don't know what you're talking about.


   
ReplyQuote
(@farzad_k)
Member
Joined: 3 years ago
Posts: 75
Topic starter  
Posted by: @will

@farzad_k 

Excellent, get your data from as close to the protected target as possible !

image

   
ReplyQuote
(@farzad_k)
Member
Joined: 3 years ago
Posts: 75
Topic starter  
Posted by: @will

@farzad_k 

Excellent, get your data from as close to the protected target as possible !

image

Of course the relationship between analogValue and analogWrite to the mosfet is not linear and has to be determined more thoughtfully, for example with due consideration to 0-255 range of analog input of each sensor. But those are minor details.


   
ReplyQuote
Will
 Will
(@will)
Member
Joined: 3 years ago
Posts: 2508
 

@farzad_k 

Looks good so far, but I was examining the MOSFET and I think you nee to add a couple of resistors to complete the MOSFET part of the circuit.

1) You should put a 100 ohm resistor between the Arduino and MOSFET gate. The MOSFET acts somewhat like a capacitor at the gate and current will flow very rapidly into it as a result. By adding the 100 ohm resistor, you reduce the initial current and save the high drain through the Arduino.

2) You should put a 10K resistor from the gate to the ground. This will tie the MOSFET low (i.e. off) when the gate is unpowered (at the start) and also keep the MOSFET off when the gate voltage falls.

Anything seems possible when you don't know what you're talking about.


   
ReplyQuote
Page 2 / 4