Analg read

Use this section to discuss your embedded Flowcode projects.
Post Reply
Amrat
Posts: 26
http://meble-kuchenne.info.pl
Joined: Sun Jan 31, 2021 11:25 am

Analg read

Post by Amrat »

I set potentiometer connect to A0 with GETBYTE and decision IF Getbyte>128 LED TurnON

When simulate its is OK but when to compile to target, LED always turn on ???

Someone please explain

Thanks
Amrat

medelec35
Matrix Staff
Posts: 1451
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 512 times
Been thanked: 472 times

Re: Analg read

Post by medelec35 »

Hi
An issue like that is when the potentiometer VRef voltage properties is set to vref+ instead VDD and Vref+ pin is left floating.
If that is not the case can you post your project file that has extension .fcfx
Martin

Amrat
Posts: 26
Joined: Sun Jan 31, 2021 11:25 am

Re: Analg read

Post by Amrat »

Hi Martin,

Thanks for your reply. About set parameter Vref I confused as no explanation on Wiki. Will you please send sample base on my fcfx file ? then I will understand.
Thanks in advance
Attached is simple file I do test.

Thanks again
Amrat
Attachments
Arduino KitOnShield.fcfx
(10.51 KiB) Downloaded 88 times

medelec35
Matrix Staff
Posts: 1451
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 512 times
Been thanked: 472 times

Re: Analg read

Post by medelec35 »

Hello.
I have modified your project by changing Vref option from the default AREF to AVCC.
Changing Vref option.png
Changing Vref option.png (78.27 KiB) Viewed 1761 times
Additionally, I have increased the conversion speed to Fosc/128 for extra stability.

I have also added a note on wiki for each potentiometer.
Attachments
Arduino KitOnShield v2.fcfx
(10.51 KiB) Downloaded 90 times
Martin

Amrat
Posts: 26
Joined: Sun Jan 31, 2021 11:25 am

Re: Analg read

Post by Amrat »

Hi Martin,

Again need some advice.

How to program to read Analog Voltage of Microphone ? as in component libraries have no mic !!

Thanks in Advance
Best rgds
Amrat

chipfryer27
Valued Contributor
Posts: 1147
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 285 times
Been thanked: 412 times

Re: Analg read

Post by chipfryer27 »

Hi

It depends on your application.

There is a component to measure strength of background sound levels, but if you are looking to record your voice or such like then things get a little more complicated and component speeds are critical to success.

Generally speaking you would need to take a reading (sample) at twice the highest frequency you wish to capture. As an example, analogue telephones have a bandwidth of 4KHz (being 300 - 3400Hz + gaps) therefore we would need to sample at 8KHz to stand a reasonable chance of recording / transmitting recognisable speech.

Whilst that works out at a sample every 125uS you have to take the time taken to actually sample and store / do something with the sample into consideration too.

Regards

Post Reply