Тёмный
No video :(

ADC noise reduction with software filter 

electrodacus
Подписаться 9 тыс.
Просмотров 26 тыс.
50% 1

This is a simple algorithm to reduce ADC (Analog to digital converter) noise.
It uses a 128 reading average and a condition not to update the reading if the new reading has only +/- 2 counts or less variation unless this count change is not just noise and persist for more than two consecutive readings.
Here is the link to the source www.electrodacu...
There are some bonus photos at the end of the video with my off-grid house build.

Опубликовано:

 

27 авг 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 46   
@mjlorton
@mjlorton 11 лет назад
Thanks for a brilliant post Dacian...one fine day I will start playing with "real" micro controllers as well ;-). Great to see the progress you are making on your home. I'm very pleased for you. Cheers, Martin.
@mjlorton
@mjlorton 11 лет назад
I had a look at the STM32 F3....looks very interesting...I'll certainly follow what you are doing. How long before you have the roof on?
@gadget_hack
@gadget_hack 8 лет назад
Thank you so much for this example. I was struggling with my project and this was the last thing missing.
@electrodacus
@electrodacus 8 лет назад
+David Ramirez Glad it was helpful for you. Thanks for the comment.
@KyleCarrington
@KyleCarrington 11 лет назад
The exterior insulation is an excellent plan. You can do any finish you want, after - I've used brown coat primus then acrylic stucco, which works nice and you can detail further with foam (insulation) "build-outs" for detailing. That is very popular here in Canada, and quite durable. A bit expensive though i suppose.
@KyleCarrington
@KyleCarrington 11 лет назад
I will say one thing, that is going to be one heck of an earthquake resilient design...!
@KyleCarrington
@KyleCarrington 11 лет назад
Definitely interesting! i see your points. Layers do add up. Sure looks beautiful.
@Mitchseen
@Mitchseen 11 лет назад
Much thanks and would appreciate more details on the progress of your new home.
@Embedonix
@Embedonix 9 лет назад
Thanks for the tutorial. Watching your code I believe there exist more optimized solutions, I have not yet tested but all those addition and substractions wastes many cpu cycles
@electrodacus
@electrodacus 9 лет назад
+EMBEDONIX It is possible that a more optimized solution can exist. I only spent a few hours on this. You can also take a look at my Solar BMS project that is open source and there is way more code there at least a few thousands of lines. There is a lot of room for optimization there also but for low volume products you better spend a few more cent on a more powerful processor maybe with more memory that wasting time optimizing the code. Optimizing the code will be more expensive in low or even medium volume.
@KyleCarrington
@KyleCarrington 11 лет назад
May I ask why the walls in the house were made stacked lumber, like that? Seems like huge added cost...
@ilhanuruc3857
@ilhanuruc3857 6 лет назад
Thanks for the code link.
@MikePoirier
@MikePoirier 11 лет назад
Your house looks great. Good design. Saving tons by DIY, I'm sure. Could you make a link to your script. I'm working on a ADC soft summation, your input would be helpful. Thanks for sharing, please show more work on your house, in the future.
@MikePoirier
@MikePoirier 11 лет назад
Hi electrodacus, Thanks for the code link.
@KyleCarrington
@KyleCarrington 11 лет назад
Dryvit makes very nice product.
@lawrencemiller3829
@lawrencemiller3829 5 лет назад
Here is pseudo code for a smoothing filter I use. This is shown using floating point numbers for convenience, but consider proper integer arithmetic. // FractionInput ranges from 0.0 to 1.0 // 1.0 is no smoothing, ADC reading copied directly to output // The smaller the number, the greater the smoothing and greater the delay of input to output FractionInput = 0.5 // Initialization Accumulator = 0.0 Loop forever Read ADC. // May be read multiple times quickly and averaged as shown in the video (128 ADC readings) // Notice that older readings are getting smaller with each pass through the loop. Accumulator = (ADCreading * FractionInput) + (Accumulator * (1.0 - FractionInput) EngineeringValue = Convert(Accumulator); Display EngineeringValue End Loop
@electrodacus
@electrodacus 5 лет назад
At the amount of noise I get in this example your filter will still be noisy and it will not react as fast to larger changes. The main idea of my code is to just ignore 1 to 2 least significant digit changes in both directions as that is distracting to see but when there is a more significant change than that I want a fast update to that value.
11 лет назад
No high winds... yet. :D Anyhow, only time will tell and I hope it will fair well.
@emelyjose
@emelyjose 7 лет назад
hello brother goodnight .... I run ....... I'm reading a temperature super hyper, mega, you can not imagine stable only modify or adapt the code to ccs and did not need lowpass filter .... I'm reading directly from the LM35 and I am using reference voltage ... imagine that I have only one error of 0.1 degrees with respect to the measurement gives me the multimeter ..... thank you very much for your support .. ... helped me much now able to continue my project .... greetings from Venezuela ...
@electrodacus
@electrodacus 7 лет назад
Glad the code was helpful for you.
@ramazanayten3758
@ramazanayten3758 2 года назад
how can we turn off the sound at an empty (noise) frequency on the fm radio, what should I use for this?
@electrodacus
@electrodacus 2 года назад
I think that is based on signal strength. So when signal is below a certain level audio will be muted.
@bilalusman4672
@bilalusman4672 4 года назад
i am using ARM controller and facing screen flicking and stuck issue. i m measuring AC voltages from relay contacts
@electrodacus
@electrodacus 4 года назад
How do you make the measurement ? Ideally you will use some isolated way to measure then there will be no influence on your circuit. I guess you have just some restive divider and that pushes to much current in your IO pins that it locks the microcontroller maybe can even damage the internal diode that protects the pins.
@jugnu361
@jugnu361 9 лет назад
Fair enough. Thank you
@cyrusworldmusic
@cyrusworldmusic 8 лет назад
True Decimation? or Moving Average?
@emelyjose
@emelyjose 7 лет назад
1- I read 128 times and then I get the average? 2 - then adctotal = r8 / 128?. 3 - I wait 100 ms? 4 - then the conditional (if ((adctotal + 1 == adctotal2) || (adctotal-1 == adctotal2) || (adctotal + 2 == adctotal2) || (adctotal-2 == adctotal2)) if I understand). 5- I do not understand this part ( - Lcd_Write_Data (adctotal2-adctotal + 3); Adctotal-adctotal subtraction and then Sums (3) = why 3? - LCD_OutUDec (Abs (adctotal2-adctotal)); Here I get the absolute value of Remains - LCD_OutUDec (adctotal2 / 1.244); Why do you divide adctotal between 1.244? Adctotal2 = (adctotal + adctotal2 + adctotal2) / 3;) I imagine that here you get the Average of the sum? 6 - I do not understand this one either Set_cursor (14,0); Lcd_Write_Data (3); What does this mean? LCD_OutUDec (adctotal / 1.244); Adctotal2 = adctotal; 7- LCD_OutUDec (nums [10] /1.244); ??????
@electrodacus
@electrodacus 7 лет назад
I wrote this about 5 years ago and do not have time to look at the code now. The idea was to simply have a more stable ADC reading by ignoring the reading noise if it was just 1 or 2 least significant digits. 5 - The 3 has to do with the bargraph indicating the delta error on the LCD probably not relevant for you. The 3 is the middle of the bargraph representing zero deviation from that you can have 1 or 2 digit negative or positive. The absolute will display the value without the sign since that is already seen in the bargraph. The microcontroller I have has a 12bit ADC so 0 to 4096 digit output and the supply voltage is about 3.3V so ADC input voltage will be from 0 to 3.3V or 3300mV then dividing the 4096/3300mV you get that aprox 1.244 6 - again as mentioned above that is the small bargraph set to zero (middle) so 3. 7 - Just display one of the readings that is part of the 128 ADC readings to see how far a single reading is from the average to get a sense of the ADC noise. You have a 10bit ADC so 0 to 1024 so resolution and measurement accuracy will be lower with the PIC microcontroller. For you is probably enough just to make an average to get a better reading since temperature changes slowly with time. Also try use a low pass filter before the ADC input to reduce any possible noise from the long temperature sensor wires. I'm guessing you are using an NTC thermistor.
@emelyjose
@emelyjose 7 лет назад
1- am using a LM35 as it specifies the hja of ... the measurement data output is stable with Multimeter. 2- respect to the power source is also stable. 3- am using reference voltage from 0 volt to 1024 mVolt and this is also stable I mean that the above three parameters do not vary simpre remain termometro except that varies with the tempeatura but no sudden vaiaciones .... I even I have placed 100 stable mVolt in emtrada the adc and still varies widely ... .for thus I imagine that the error is internal .. that's why we want to implement this filter because it works for you great. Thanks for the prompt response...
@electrodacus
@electrodacus 7 лет назад
Your ADC will make fast sampling of the signal so it can measure peak voltage. I do not know your schematic but try to use a low pas filter realy close to the ADC input made of say a 1Kohm resistor and a 22uF between ADC input and ground. I'm sure this will hugely improve the ADC reading. If you notice in my video the ADC reading without any filtering is the first display value and while it has some variation is no more than 4 to 5 digit. In your case 5 digit variation will be about 0.5C variation without any averaging or filtering. But since is a slow signal best way to filter is in hardware with a low pas filter as mentioned then if you want you can add some software filter for even better accuracy.
@emelyjose
@emelyjose 7 лет назад
ok .. I will adapt the filter as you recommend, then you commented, thank you very much for your time greetings'll be in touch.
@jugnu361
@jugnu361 9 лет назад
Source code is empty , a blinky n lcd sample only..
@electrodacus
@electrodacus 9 лет назад
+Sachin Singh Hi, I just took a look at the code and yes it looks that way but is not. All the code is in the GPIO_LCD1602 there is no excuse for this :) but was just a short experiment I done in a few hours so in not well organized not to mention I'm more of a HW engineer not so much SW but this is an old video I learned a bit since then :)
@Nihilokkk
@Nihilokkk 8 лет назад
what about a software schmitt trigger?
@electrodacus
@electrodacus 8 лет назад
+Nihilokkk You can say that but the scope was not exactly that since you keep the signal "analog" except for narrow hysteresis portion where you do nothing. On top of that not many will know what a schmitt trigger is and will not search for that. Thanks for the comment.
@Nihilokkk
@Nihilokkk 8 лет назад
+electrodacus I meant what about implementing a Schmitt trigger. But you are right its a bit a different concept that is not fully useful here.
@electrodacus
@electrodacus 8 лет назад
+Nihilokkk Yes almost no software is needed for that just an if ADC value higher than x1 set to 1 and if ADC less than x2 set to zero. It is probably used all the time not sure if is called a software Schmitt trigger or not. There are a lot of this sort of triggers in my current project the Solar BMS where I need to check multiple cell voltages and set upper and lower limits for charging or load and same with currents. Solar BMS is open source software and hardware so if you are interested take a look at my google+ page plus.google.com/+electrodacus/posts Software is done and code will be released in a few weeks at most.
@hamid.s.zolfagari
@hamid.s.zolfagari 5 лет назад
Hi Your main.c file is empty .
@electrodacus
@electrodacus 5 лет назад
It is not empty but I think I know what you mean. Go in to example folder and check the GPIO_LCD160.c file.
@ilanmagen
@ilanmagen 9 лет назад
I love the project but I like better your house project
@electrodacus
@electrodacus 9 лет назад
:) Maybe the Solar BMS project is a better rival to the house project.
@ilanmagen
@ilanmagen 9 лет назад
***** brilliant design and build, so as the house
11 лет назад
And he builds his house in a traditional Romanian style, almost... :D Not from cardboard and drywall like the folks around him. Man... That is such a wasteland. Not one tree in sight! I bet the winds blow like hell, in there. Alright for a wind turbine but not for your new home. The house looks like coming out alright but I haven't seen a trace of foundation! It's free-floating on the ground and without proper anchorage... you might get swept by the winds or worse...
11 лет назад
Or are you planning to wheel it out of that place, one day? :D
Далее
New Dyna Skin is OP🥵🔥 | Brawl Stars
00:16
Просмотров 138 тыс.
Can You Bend This Bar?
01:00
Просмотров 4,3 млн
How to remove noise from old tape recording
3:08
Просмотров 48 тыс.
How to Decrease Noise in your Signals
7:42
Просмотров 44 тыс.
Unbelievable Noise Cancellation Experiment
7:52
Просмотров 324 тыс.
New Dyna Skin is OP🥵🔥 | Brawl Stars
00:16
Просмотров 138 тыс.