Ligne 92 : |
Ligne 92 : |
| The following scope capture show the 3V3 rail at very low current. As shown, je 3V3 contains lot of noise (Saw Waveform). | | The following scope capture show the 3V3 rail at very low current. As shown, je 3V3 contains lot of noise (Saw Waveform). |
| | | |
− | [[Fichier:Pico-3V3-regulation-at-low-current.png]] | + | [[Fichier:Pico-3V3-regulation-at-low-current.png|640px]] |
| | | |
| As the analog sensors are very sensitive to unstable power voltage. Variation and noise on power rail may cause important variation on analog output of an analog sensor. | | As the analog sensors are very sensitive to unstable power voltage. Variation and noise on power rail may cause important variation on analog output of an analog sensor. |
Ligne 98 : |
Ligne 98 : |
| [[Fichier:Pico-TMP36-improved-wiring.png|480px]] | | [[Fichier:Pico-TMP36-improved-wiring.png|480px]] |
| | | |
| + | By adding the 2200µF capacitor, the noisy saw waveform will be changed and adding the 10nF will greatly reduce the noise opn the PowerRail. |
| + | |
| + | [[Fichier:Pico-TMP36-improved-wiring-2.png|640px]] |
| + | |
| + | == Improving the code == |
| + | A good way to improve stability in the readings is to preform a means calculation over several reading. |
| + | |
| + | <syntaxhighlight lang="python"> |
| + | # Mean read the TMP36 analog temperature |
| + | # sensor wired to ADC0 (GP26) |
| + | # |
| + | from machine import ADC, Pin |
| + | import time |
| + | |
| + | adc = ADC(Pin(26)) |
| + | while True: |
| + | value = 0 |
| + | for i in range(10): |
| + | value += adc.read_u16() |
| + | value /= 10 |
| + | mv = 3300.0 * value / 65535 |
| + | temp = (mv-500)/10 |
| + | print( 'Temp: %5.2f °C, Voltage: %4i mV' % (temp,mv) ) |
| + | time.sleep(0.100 ) |
| + | </syntaxhighlight> |
| | | |
| {{ENG-CANSAT-PICO-TRAILER}} | | {{ENG-CANSAT-PICO-TRAILER}} |