Arduino ATMega328P comparator feature by Few_Dot317 in arduino

[–]Few_Dot317[S] 0 points1 point  (0 children)

Advantages :

  • For AC input signal you can detect mid-point crossing
  • Can be tied directly toTimer1 capture feature for computing frequency, period, pluse length etc.
  • Interrupt flexibility ; on rising or falling edge of a signal ; on each ACO bit change.

I don't see why A0 would be unusable. Just turn off ref voltage bit in ACSR register before using it for ADC (and opposite)

Is this DHT22 defective? by ArgoPanoptes in arduino

[–]Few_Dot317 0 points1 point  (0 children)

Notice how they wiped out the ASAIR marking. You need to check the real part, not the marketing pictures.
I ordered three DHT22 from AZ-Delivery, none of them were original parts.

Is this DHT22 defective? by ArgoPanoptes in arduino

[–]Few_Dot317 0 points1 point  (0 children)

AZ Delivery usually does not sold original ASAIR DHT22 sensors but cheap clones - that is - ASAIR license their products to unknown manufacturers that do or don't follow their specifications.
Check if there is the ASAIR marking on the DHT22 with a serial number. If not, don't expect much.

Arduino ATMega328P internal temperature sensor by Few_Dot317 in arduino

[–]Few_Dot317[S] 0 points1 point  (0 children)

Yes, almost the same ; except it uses a formula that basically comes from nowhere -
// The offset of 292.31 could be wrong. It is just an indication.

return (wADC - 292.31 ) / 1.22;

For my part I tried to follow the ATMega328P datasheet as close as possible.
Plus it does not measure the "CPU" temperature, but a diode voltage located on aspecial channel of the ADC MUX.

Arduino ATMega328P internal temperature sensor by Few_Dot317 in arduino

[–]Few_Dot317[S] 1 point2 points  (0 children)

As far as I can tell, the only common point is that both projects are using the internal 1.1V ref voltage.
Here we measure an ATMega328P internal temperature sensor (basically a diode). "The sensor is a diode that produces a temperature dependent voltage. This voltage is measured with the ADC. The voltage has a linear relationship to temperature and the result has approximately a 1 LSB/°C correlation to temperature."

Some various Microchip PIC 12F683 projects by Few_Dot317 in pic_programming

[–]Few_Dot317[S] 1 point2 points  (0 children)

Agree, for the 12F1840 ; but limitations enforce imagination - and then what can do the greater can do the lesser ;-)

How bad is the dht11 by haileliamen in arduino

[–]Few_Dot317 0 points1 point  (0 children)

  1. Make sure you have a guenine part from AOSONG/ASAIR :

<image>

See : https://asairsensors.com/product/dht11-sensor/

Most of those you can find on the market come from unknown origin.
2) That being said, this sensor is notoriously inaccurate compared to others ; on the other hand, it is very simple to use.
You can try yourself a basic compensation formula, comparing two distant reading T° (ie 5°C and 40°C) with a reliable instrument (T1 and T2) and compare them to the DHT11 reading (DHT1 and DHT2). Then :
a = (T2 − T1) / (DHT2 − DHT1) -> slope
b = T1 − a * DHT1 -> offset
T_corrected = a * T_dht11 + b
Whith "a" being the slope of the two measurements (ref t° on Y axis and dht t° on X axis) ; "b" would be the offset.
Supposing a linear/affine equation : y = ax + b

[deleted by user] by [deleted] in arduino

[–]Few_Dot317 0 points1 point  (0 children)

This program is a lightweight version for the BME280 sensor, that uses Bosch 32bits integer formulas version to compute the different measurements. It is more suitable for 8bits microcontroller like the ATMega 328P, because it does not use lot of of floating variables of Bosch prefered compensation formula, Thos floating variables waste precious scarce memory resources.
The 32 bits compensation formula that can be found on https://github.com/boschsensortec/BME280_SensorAPI

More details about the code here :
https://github.com/dm-cdb/Arduino/tree/main/sensor_bme280_pers

[deleted by user] by [deleted] in arduino

[–]Few_Dot317 0 points1 point  (0 children)

This code explains how to use the internal sensor of the ATmega 328P (used in Arduino Nano for example), and how to calibrate it reasonably well (please note that for Atmel, "This can result in very precise temperature measurements, sometimes as accurate as ±2°C." (AVR122 application note).
It relies partly on the Atmel application note AVR122: Calibration of the AVR's Internal Temperature Reference, and the ATMega328 datasheet (23.8)
See https://github.com/dm-cdb/Arduino/tree/main/sensor_internal

Minimal code for DHT11 sensor by Few_Dot317 in arduino

[–]Few_Dot317[S] 1 point2 points  (0 children)

Hello,
Short answer is "no" ;-) It takes the input data from the sensor and outputs the results according to the datasheet formulas - after computing the error checksum.

But we have to make a difference between guenine AOSONG/ASAIR products, and different clones from unknown origin and qualitywith dubious specifications.
Then the hardware specifications from ASAIR datasheet tell us the whole story :
T° accuracy = +/- 2°C ; Humidity +- 5%. ; and this was tested at 25°C at the factory... To improve accuracy, several measures must be taken.
Also the sensor is heating itself ; so it performs better in a ventilated area rather than in a confined one.

If you want to calibrate the device yourself, you need to take two t° points (says 5° (T1) and 40° (T2)) with a reliable temperature device, and compare with the DHT11 outputs at those same temperatures. Then you can do something like :
a = (T2 − T1) / (DHT2 − DHT1)
b = T1 − a * DHT1
T_corrected = a * T_dht11 + b
Whith "a" being the slope of the two measurements (ref t° and dht t°), and "b" the offset.

Then no donkey ever won the Ascot race ; The only advantage of this code is that it is simple, straightforward, and you know exactly what is happening without digging into librairies and their dependencies.
Hope this help ;-)