Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Naponska i strujna referenca i 16bit ADC
#3
Mozda formula nije bas najbolja ali pokusao sam da izmerim otpornik od 220 ohm, u adc na A1 kanal merim napon baterije a U kanalu A0 napon na donjem kraju otpornika gde nam je poznat Iref, struja je poznata i ona prati naponsku referencu znaci 2.0474mA konstantno, otpornik je spojen izmedju +5V baterije i Iref, i finalno furmula bi trebala da glasi ako ne gresim:

(naponbaterije - naponnaotporniku) / Iref

rezultat i nije tako los:
Code:
batteryVolts=5.153220 , dropVolts=4.706206 , ohms=218.328270
batteryVolts=5.151720 , dropVolts=4.704706 , ohms=218.328270
batteryVolts=5.152845 , dropVolts=4.705081 , ohms=218.694846
batteryVolts=5.152282 , dropVolts=4.704706 , ohms=218.603086
batteryVolts=5.151720 , dropVolts=4.704331 , ohms=218.511558
batteryVolts=5.152470 , dropVolts=4.705268 , ohms=218.420030
batteryVolts=5.152282 , dropVolts=4.704519 , ohms=218.694613
batteryVolts=5.152282 , dropVolts=4.704331 , ohms=218.786374
batteryVolts=5.152095 , dropVolts=4.704894 , ohms=218.420030
batteryVolts=5.152282 , dropVolts=4.705268 , ohms=218.328503
batteryVolts=5.152282 , dropVolts=4.704706 , ohms=218.603086
batteryVolts=5.152470 , dropVolts=4.705081 , ohms=218.511558
batteryVolts=5.151907 , dropVolts=4.704706 , ohms=218.420030
batteryVolts=5.151720 , dropVolts=4.704331 , ohms=218.511558
batteryVolts=5.152470 , dropVolts=4.705268 , ohms=218.420030
batteryVolts=5.152282 , dropVolts=4.705081 , ohms=218.420030
batteryVolts=5.152470 , dropVolts=4.705081 , ohms=218.511558
batteryVolts=5.151907 , dropVolts=4.704706 , ohms=218.420030
batteryVolts=5.150970 , dropVolts=4.704706 , ohms=217.961927
batteryVolts=5.151907 , dropVolts=4.704894 , ohms=218.328503
batteryVolts=5.152657 , dropVolts=4.705456 , ohms=218.419798
batteryVolts=5.153407 , dropVolts=4.706394 , ohms=218.328270
batteryVolts=5.153220 , dropVolts=4.706206 , ohms=218.328270
batteryVolts=5.153032 , dropVolts=4.706394 , ohms=218.145215
batteryVolts=5.153595 , dropVolts=4.706018 , ohms=218.603319
batteryVolts=5.152657 , dropVolts=4.705081 , ohms=218.603086
batteryVolts=5.153595 , dropVolts=4.705644 , ohms=218.786374
batteryVolts=5.152470 , dropVolts=4.705831 , ohms=218.145215
batteryVolts=5.152282 , dropVolts=4.704706 , ohms=218.603086
batteryVolts=5.152095 , dropVolts=4.706394 , ohms=217.687344
batteryVolts=5.152470 , dropVolts=4.705831 , ohms=218.145215
batteryVolts=5.151720 , dropVolts=4.705268 , ohms=218.053687
batteryVolts=5.153032 , dropVolts=4.705268 , ohms=218.694846
batteryVolts=5.152845 , dropVolts=4.705831 , ohms=218.328503
batteryVolts=5.153032 , dropVolts=4.705831 , ohms=218.420030
batteryVolts=5.151907 , dropVolts=4.705456 , ohms=218.053687
batteryVolts=5.152657 , dropVolts=4.704894 , ohms=218.694613
batteryVolts=5.152470 , dropVolts=4.705268 , ohms=218.420030
batteryVolts=5.151532 , dropVolts=4.705268 , ohms=217.962160
batteryVolts=5.151907 , dropVolts=4.704894 , ohms=218.328503
batteryVolts=5.152095 , dropVolts=4.705268 , ohms=218.236975
batteryVolts=5.153032 , dropVolts=4.705644 , ohms=218.511558
batteryVolts=5.151907 , dropVolts=4.704706 , ohms=218.420030
batteryVolts=5.152095 , dropVolts=4.705268 , ohms=218.236975
batteryVolts=5.152657 , dropVolts=4.705644 , ohms=218.328270
batteryVolts=5.151907 , dropVolts=4.704706 , ohms=218.420030
batteryVolts=5.151907 , dropVolts=4.705268 , ohms=218.145448
batteryVolts=5.153032 , dropVolts=4.705456 , ohms=218.603086
batteryVolts=5.151345 , dropVolts=4.704519 , ohms=218.236742
batteryVolts=5.153032 , dropVolts=4.706018 , ohms=218.328503
batteryVolts=5.152095 , dropVolts=4.704894 , ohms=218.420030
batteryVolts=5.152470 , dropVolts=4.705081 , ohms=218.511558
batteryVolts=5.152470 , dropVolts=4.705644 , ohms=218.236742
batteryVolts=5.153782 , dropVolts=4.706769 , ohms=218.328503
batteryVolts=5.152845 , dropVolts=4.705456 , ohms=218.511558
batteryVolts=5.153407 , dropVolts=4.706206 , ohms=218.419798
batteryVolts=5.152657 , dropVolts=4.705831 , ohms=218.236742
batteryVolts=5.153407 , dropVolts=4.706018 , ohms=218.511558
batteryVolts=5.153220 , dropVolts=4.706018 , ohms=218.420030
batteryVolts=5.153595 , dropVolts=4.706394 , ohms=218.420030
batteryVolts=5.152282 , dropVolts=4.704894 , ohms=218.511558
batteryVolts=5.152657 , dropVolts=4.705456 , ohms=218.419798
batteryVolts=5.152657 , dropVolts=4.705831 , ohms=218.236742
batteryVolts=5.153595 , dropVolts=4.706018 , ohms=218.603319
batteryVolts=5.152845 , dropVolts=4.705831 , ohms=218.328503
batteryVolts=5.152845 , dropVolts=4.704706 , ohms=218.877901
batteryVolts=5.153407 , dropVolts=4.705268 , ohms=218.877901
batteryVolts=5.154532 , dropVolts=4.706581 , ohms=218.786374
batteryVolts=5.152095 , dropVolts=4.704519 , ohms=218.603086
batteryVolts=5.152282 , dropVolts=4.705456 , ohms=218.236742
batteryVolts=5.152845 , dropVolts=4.705456 , ohms=218.511558
batteryVolts=5.153407 , dropVolts=4.706206 , ohms=218.419798
batteryVolts=5.152470 , dropVolts=4.705831 , ohms=218.145215
batteryVolts=5.151532 , dropVolts=4.705456 , ohms=217.870399
batteryVolts=5.152095 , dropVolts=4.704894 , ohms=218.420030
batteryVolts=5.153032 , dropVolts=4.705268 , ohms=218.694846
batteryVolts=5.153032 , dropVolts=4.705644 , ohms=218.511558
batteryVolts=5.153220 , dropVolts=4.705456 , ohms=218.694613
batteryVolts=5.151720 , dropVolts=4.704706 , ohms=218.328270
batteryVolts=5.153407 , dropVolts=4.705831 , ohms=218.603086
batteryVolts=5.153032 , dropVolts=4.706206 , ohms=218.236742
batteryVolts=5.153595 , dropVolts=4.705268 , ohms=218.969662
batteryVolts=5.152845 , dropVolts=4.705644 , ohms=218.420030
batteryVolts=5.152657 , dropVolts=4.705268 , ohms=218.511558
batteryVolts=5.152657 , dropVolts=4.705831 , ohms=218.236742
batteryVolts=5.153407 , dropVolts=4.706394 , ohms=218.328270
batteryVolts=5.153595 , dropVolts=4.706206 , ohms=218.511558
batteryVolts=5.152095 , dropVolts=4.704894 , ohms=218.420030
batteryVolts=5.152845 , dropVolts=4.704894 , ohms=218.786374
batteryVolts=5.152470 , dropVolts=4.704894 , ohms=218.603086
batteryVolts=5.153220 , dropVolts=4.706018 , ohms=218.420030
batteryVolts=5.152470 , dropVolts=4.704706 , ohms=218.694613
batteryVolts=5.153032 , dropVolts=4.705831 , ohms=218.420030
batteryVolts=5.152470 , dropVolts=4.705268 , ohms=218.420030
batteryVolts=5.153407 , dropVolts=4.705831 , ohms=218.603086
batteryVolts=5.152470 , dropVolts=4.705268 , ohms=218.420030
batteryVolts=5.153032 , dropVolts=4.705268 , ohms=218.694846
batteryVolts=5.153407 , dropVolts=4.705081 , ohms=218.969429
batteryVolts=5.150970 , dropVolts=4.703393 , ohms=218.603086
batteryVolts=5.153407 , dropVolts=4.705831 , ohms=218.603086
batteryVolts=5.153407 , dropVolts=4.705456 , ohms=218.786141
batteryVolts=5.153407 , dropVolts=4.706018 , ohms=218.511558
batteryVolts=5.153407 , dropVolts=4.706394 , ohms=218.328270
batteryVolts=5.153220 , dropVolts=4.705456 , ohms=218.694613
batteryVolts=5.153220 , dropVolts=4.705081 , ohms=218.877901
batteryVolts=5.154532 , dropVolts=4.706018 , ohms=219.061190
batteryVolts=5.152845 , dropVolts=4.705644 , ohms=218.420030
batteryVolts=5.152845 , dropVolts=4.705456 , ohms=218.511558
batteryVolts=5.152845 , dropVolts=4.705081 , ohms=218.694846
batteryVolts=5.153595 , dropVolts=4.706206 , ohms=218.511558
batteryVolts=5.152470 , dropVolts=4.705081 , ohms=218.511558
batteryVolts=5.152095 , dropVolts=4.705268 , ohms=218.236975
batteryVolts=5.152657 , dropVolts=4.705831 , ohms=218.236742
batteryVolts=5.153407 , dropVolts=4.706394 , ohms=218.328270
batteryVolts=5.152470 , dropVolts=4.704519 , ohms=218.786141
batteryVolts=5.153032 , dropVolts=4.706018 , ohms=218.328503
batteryVolts=5.153032 , dropVolts=4.705456 , ohms=218.603086
batteryVolts=5.153407 , dropVolts=4.705644 , ohms=218.694613
batteryVolts=5.153220 , dropVolts=4.705831 , ohms=218.511558
batteryVolts=5.153407 , dropVolts=4.706206 , ohms=218.419798
batteryVolts=5.152282 , dropVolts=4.704519 , ohms=218.694613
batteryVolts=5.153220 , dropVolts=4.705831 , ohms=218.511558
batteryVolts=5.153220 , dropVolts=4.705831 , ohms=218.511558
batteryVolts=5.152657 , dropVolts=4.704894 , ohms=218.694613
batteryVolts=5.153782 , dropVolts=4.706018 , ohms=218.694846
batteryVolts=5.152657 , dropVolts=4.705831 , ohms=218.236742
batteryVolts=5.153032 , dropVolts=4.706206 , ohms=218.236742
batteryVolts=5.153407 , dropVolts=4.705644 , ohms=218.694613
batteryVolts=5.152282 , dropVolts=4.704706 , ohms=218.603086
batteryVolts=5.151720 , dropVolts=4.705081 , ohms=218.145215
batteryVolts=5.152470 , dropVolts=4.705081 , ohms=218.511558
batteryVolts=5.152657 , dropVolts=4.705081 , ohms=218.603086
batteryVolts=5.153407 , dropVolts=4.706394 , ohms=218.328270
batteryVolts=5.152845 , dropVolts=4.705456 , ohms=218.511558
batteryVolts=5.152095 , dropVolts=4.705268 , ohms=218.236975
batteryVolts=5.153407 , dropVolts=4.706394 , ohms=218.328270
batteryVolts=5.153595 , dropVolts=4.705831 , ohms=218.694846
batteryVolts=5.152470 , dropVolts=4.704894 , ohms=218.603086
batteryVolts=5.153032 , dropVolts=4.705456 , ohms=218.603086
batteryVolts=5.152657 , dropVolts=4.705644 , ohms=218.328270
batteryVolts=5.153032 , dropVolts=4.705456 , ohms=218.603086
batteryVolts=5.153032 , dropVolts=4.705456 , ohms=218.603086
batteryVolts=5.151907 , dropVolts=4.704331 , ohms=218.603319
batteryVolts=5.153782 , dropVolts=4.706206 , ohms=218.603086
batteryVolts=5.152095 , dropVolts=4.704894 , ohms=218.420030
batteryVolts=5.152095 , dropVolts=4.704331 , ohms=218.694846
batteryVolts=5.152470 , dropVolts=4.705456 , ohms=218.328270
batteryVolts=5.152657 , dropVolts=4.705456 , ohms=218.419798
batteryVolts=5.152657 , dropVolts=4.705268 , ohms=218.511558
batteryVolts=5.153220 , dropVolts=4.705644 , ohms=218.603086
batteryVolts=5.153782 , dropVolts=4.705081 , ohms=219.152717
batteryVolts=5.151720 , dropVolts=4.704519 , ohms=218.419798
batteryVolts=5.152657 , dropVolts=4.704519 , ohms=218.877669
batteryVolts=5.152657 , dropVolts=4.705081 , ohms=218.603086
batteryVolts=5.151532 , dropVolts=4.703956 , ohms=218.603086
batteryVolts=5.152845 , dropVolts=4.704706 , ohms=218.877901
batteryVolts=5.153220 , dropVolts=4.705831 , ohms=218.511558
batteryVolts=5.153220 , dropVolts=4.705456 , ohms=218.694613
batteryVolts=5.152095 , dropVolts=4.704894 , ohms=218.420030
batteryVolts=5.152845 , dropVolts=4.705644 , ohms=218.420030
batteryVolts=5.152845 , dropVolts=4.705268 , ohms=218.603319
batteryVolts=5.152845 , dropVolts=4.705456 , ohms=218.511558
batteryVolts=5.153032 , dropVolts=4.704519 , ohms=219.060957
batteryVolts=5.152845 , dropVolts=4.705081 , ohms=218.694846
batteryVolts=5.153220 , dropVolts=4.705644 , ohms=218.603086
batteryVolts=5.152282 , dropVolts=4.704706 , ohms=218.603086
batteryVolts=5.152470 , dropVolts=4.705081 , ohms=218.511558
batteryVolts=5.152282 , dropVolts=4.704519 , ohms=218.694613
batteryVolts=5.152657 , dropVolts=4.705268 , ohms=218.511558
batteryVolts=5.153407 , dropVolts=4.706206 , ohms=218.419798
batteryVolts=5.151532 , dropVolts=4.704144 , ohms=218.511558
batteryVolts=5.152845 , dropVolts=4.705081 , ohms=218.694846
batteryVolts=5.152282 , dropVolts=4.705268 , ohms=218.328503
batteryVolts=5.153970 , dropVolts=4.705831 , ohms=218.877901
batteryVolts=5.153595 , dropVolts=4.704706 , ohms=219.244245
batteryVolts=5.152657 , dropVolts=4.705644 , ohms=218.328270
batteryVolts=5.153595 , dropVolts=4.706206 , ohms=218.511558
batteryVolts=5.153032 , dropVolts=4.705268 , ohms=218.694846
batteryVolts=5.153032 , dropVolts=4.705268 , ohms=218.694846
batteryVolts=5.152845 , dropVolts=4.705644 , ohms=218.420030
batteryVolts=5.153407 , dropVolts=4.706206 , ohms=218.419798
batteryVolts=5.152845 , dropVolts=4.705268 , ohms=218.603319
batteryVolts=5.151720 , dropVolts=4.704894 , ohms=218.236742
batteryVolts=5.152657 , dropVolts=4.705644 , ohms=218.328270
batteryVolts=5.152657 , dropVolts=4.704894 , ohms=218.694613
batteryVolts=5.152845 , dropVolts=4.705268 , ohms=218.603319
batteryVolts=5.153220 , dropVolts=4.706394 , ohms=218.236742
batteryVolts=5.152470 , dropVolts=4.705831 , ohms=218.145215
batteryVolts=5.151720 , dropVolts=4.705081 , ohms=218.145215
batteryVolts=5.152845 , dropVolts=4.705456 , ohms=218.511558
batteryVolts=5.152282 , dropVolts=4.704706 , ohms=218.603086
batteryVolts=5.153407 , dropVolts=4.705644 , ohms=218.694613
batteryVolts=5.153220 , dropVolts=4.706394 , ohms=218.236742
batteryVolts=5.152470 , dropVolts=4.704706 , ohms=218.694613
batteryVolts=5.152657 , dropVolts=4.705268 , ohms=218.511558
batteryVolts=5.153595 , dropVolts=4.706581 , ohms=218.328503
batteryVolts=5.154157 , dropVolts=4.706581 , ohms=218.603086
batteryVolts=5.152845 , dropVolts=4.705831 , ohms=218.328503
batteryVolts=5.152095 , dropVolts=4.705644 , ohms=218.053687
batteryVolts=5.152470 , dropVolts=4.705081 , ohms=218.511558
batteryVolts=5.153220 , dropVolts=4.705831 , ohms=218.511558
batteryVolts=5.152657 , dropVolts=4.705268 , ohms=218.511558
batteryVolts=5.152095 , dropVolts=4.705644 , ohms=218.053687
batteryVolts=5.152470 , dropVolts=4.705081 , ohms=218.511558
batteryVolts=5.153595 , dropVolts=4.706018 , ohms=218.603319
batteryVolts=5.153407 , dropVolts=4.705644 , ohms=218.694613
batteryVolts=5.153220 , dropVolts=4.705831 , ohms=218.511558
batteryVolts=5.153407 , dropVolts=4.706206 , ohms=218.419798
batteryVolts=5.153595 , dropVolts=4.706018 , ohms=218.603319
batteryVolts=5.153970 , dropVolts=4.705831 , ohms=218.877901
batteryVolts=5.153970 , dropVolts=4.706581 , ohms=218.511558
batteryVolts=5.154345 , dropVolts=4.706581 , ohms=218.694846
batteryVolts=5.153782 , dropVolts=4.705831 , ohms=218.786374
batteryVolts=5.152657 , dropVolts=4.705456 , ohms=218.419798
batteryVolts=5.153970 , dropVolts=4.706581 , ohms=218.511558
batteryVolts=5.152470 , dropVolts=4.705456 , ohms=218.328270
batteryVolts=5.152282 , dropVolts=4.704706 , ohms=218.603086
batteryVolts=5.153407 , dropVolts=4.706769 , ohms=218.145215
batteryVolts=5.152470 , dropVolts=4.706018 , ohms=218.053687
batteryVolts=5.152845 , dropVolts=4.705081 , ohms=218.694846
batteryVolts=5.152470 , dropVolts=4.705456 , ohms=218.328270
batteryVolts=5.152282 , dropVolts=4.704894 , ohms=218.511558
batteryVolts=5.152845 , dropVolts=4.705456 , ohms=218.511558
batteryVolts=5.152657 , dropVolts=4.705081 , ohms=218.603086
batteryVolts=5.154532 , dropVolts=4.706581 , ohms=218.786374
batteryVolts=5.153595 , dropVolts=4.705831 , ohms=218.694846
batteryVolts=5.152657 , dropVolts=4.705831 , ohms=218.236742
batteryVolts=5.153407 , dropVolts=4.706394 , ohms=218.328270
batteryVolts=5.152095 , dropVolts=4.704894 , ohms=218.420030
batteryVolts=5.153970 , dropVolts=4.706394 , ohms=218.603086
batteryVolts=5.153220 , dropVolts=4.706394 , ohms=218.236742
batteryVolts=5.153595 , dropVolts=4.705644 , ohms=218.786374
batteryVolts=5.153032 , dropVolts=4.705456 , ohms=218.603086
batteryVolts=5.151720 , dropVolts=4.704144 , ohms=218.603086
batteryVolts=5.152845 , dropVolts=4.705456 , ohms=218.511558
batteryVolts=5.152095 , dropVolts=4.704144 , ohms=218.786374
batteryVolts=5.153407 , dropVolts=4.706018 , ohms=218.511558
batteryVolts=5.152095 , dropVolts=4.705081 , ohms=218.328503
batteryVolts=5.152282 , dropVolts=4.704519 , ohms=218.694613
batteryVolts=5.152845 , dropVolts=4.704894 , ohms=218.786374
batteryVolts=5.152095 , dropVolts=4.703956 , ohms=218.877901
batteryVolts=5.152845 , dropVolts=4.705081 , ohms=218.694846
batteryVolts=5.153970 , dropVolts=4.706018 , ohms=218.786374
batteryVolts=5.153032 , dropVolts=4.705456 , ohms=218.603086
batteryVolts=5.152282 , dropVolts=4.704894 , ohms=218.511558
batteryVolts=5.153407 , dropVolts=4.706394 , ohms=218.328270
batteryVolts=5.151720 , dropVolts=4.704331 , ohms=218.511558
batteryVolts=5.152282 , dropVolts=4.704706 , ohms=218.603086
batteryVolts=5.153595 , dropVolts=4.705456 , ohms=218.877901
batteryVolts=5.153407 , dropVolts=4.706018 , ohms=218.511558
batteryVolts=5.153032 , dropVolts=4.705081 , ohms=218.786374
batteryVolts=5.153032 , dropVolts=4.704519 , ohms=219.060957
batteryVolts=5.153032 , dropVolts=4.705456 , ohms=218.603086
batteryVolts=5.152282 , dropVolts=4.704519 , ohms=218.694613
batteryVolts=5.152282 , dropVolts=4.704706 , ohms=218.603086

Rezultat i nije tako los sa obzirom da je na istoj bateriji spojen i raspberry pi zero w i to verovatno daje neku nestabilnost. Ovo bi moglo da se zbroji i podeli na broj uzoraka, recimo na broj uzoraka u sekundi i da se dobije osrednja vrednost otpornika sto i nije los rezultat. Imamo i jos dva kanala slobodna na ADC na koji bi mogli direktno da zakacimo Vref i da ujedno imamo i tu vrednost koju prati Iref tako da na svakom samplu imamo poznate i te vrednosti za jos bolji rezultat.

Edit:
Ovaj program dole, doradio sam ga dodavanjem merenja u 50 semplova, u svakom semplu meri sve vrednosti pre nego prodju kroz formulu za izracunavanje otpornosti otpornika. Direktno meri napon baterije, pad napona na otporniku i Vref. Nisam ga probao jer sam rastavio sklop trenutno pa cu probati jednom kada budem ponovo spojio za probu, bi trebalo da izmeri prilicno tacnu vrecnost otpornika, na IN2 je spojen vref, na IN0 donji kraj otpornika + Iref, na IN1 gornji kraj otpornika + (+5V), rezultat 50 semplova se zbraja i na kraju deli sa 50, to bi trebalo da daje tacnu vrednost otpornika. Zamisao ove sprave je bila da se njome radi precizno uparivanje otpornika vrednosti do 2.5k ohm, dali sam uspeo ne znam jos uvek, mislim da jesam? Revizija bi trebala da bude dodavanje preklopnika za izbor R4 ref otpornika od kojeg nam zavisi strujna referenca od koje direktno zavisi i range merenog otpornika. I dodavanje mcu po izboru kao i displeja. Takodje skutijavanje uredjaja uz dodavanje litium baterije sa svojim sklopom za punjenje. Bilo bi odlicno da se pribave kelvin pipalice pa tako da se modifikuje i doradi shema i pcb sa svim ovim osobinama koje sam nabrojao, mislim da bi moglo sve skupa da kosta u okvirima $100 a da bude vrlo korektan namenski uredjaj? Ako ste zainteresovani mozemo zajedno da reviziramo ovakav jedan uredjaj uz vase predloge i sugestije!


Attached Files
.c   ref.c (Size: 11,06 KB / Downloads: 8)
Reply


Messages In This Thread
RE: Naponska i strujna referenca i 16bit ADC - by savan - 06-15-2023, 03:29 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)