#104

  Рет қаралды 47,903

Ralph S Bacon

Ralph S Bacon

Күн бұрын

Пікірлер: 216
@andrewpusey6339
@andrewpusey6339 5 жыл бұрын
A few suggestions. Separate clean power supply to module. Check for noise on power lines with scope, add capacitor smoothing. Put module in shielded case. Use shielded cables, ie coax. Run in diffential mode with reference to ground on pot. Add low value capacitor across input line and ground. Hope that helps.
@RalphBacon
@RalphBacon 5 жыл бұрын
I think that is probably the most exhaustive list I've seen on reducing (perhaps eliminating) noise on the analog inputs. Excellent work, thanks for sharing, Andrew, everyone reading this will benefit.
@Rendra5758
@Rendra5758 3 жыл бұрын
So do I, will try this suggestions
@timanderson5723
@timanderson5723 Жыл бұрын
Your video's are amazing "Hello World" examples to get people up and running on devices like this. I have used many of your videos to get started on things. The sky is the limit as to how far a user wants to take what you have shown and enhance it with input filtering, power supply decoupling, AGND and PGND, auto range selection, etc. Nice work!
@RalphBacon
@RalphBacon Жыл бұрын
Wow, thanks!
@gtcollection6933
@gtcollection6933 2 жыл бұрын
With the amount of antenna picking noise, among hundred other things you have around that set-up, I have to say the stability is beyond amazing. I've worked with the ADS1118 over SPI and it was rock solid "on PCB" with AGND and PGND routing, spot on, zero jitter. Hope to use theADS1115 in a tight'er setup this coming week and was looking for heads up. Your video inspired to get this part. Thanks
@RalphBacon
@RalphBacon 2 жыл бұрын
I'm glad my video was "inspirational". My work here is done. 👍
@JxH
@JxH 7 жыл бұрын
The inline errata (text corrections at the appropriate point) are fantastic. Lovely. Perfect. Thank you.
@RalphBacon
@RalphBacon 7 жыл бұрын
I'm glad you're liking my videos, JH. Thanks for your post, good to hear from you.
@TYGAMatt
@TYGAMatt Жыл бұрын
What can I say? Using the wire library is super fast! Using the "single ended" function on the Adafruit library was taking about 7ms to basically measure the adc and then calculate temperature. Using the ADS1115_WE library dropped that to 220us. Now using your method it has dropped again to 150us. Wow wow wow!!! Cheers Matt​
@RalphBacon
@RalphBacon Жыл бұрын
Speedy stuff!
@philippe5394
@philippe5394 6 жыл бұрын
Hello Ralph, I discovered last evening, your KZbin channel. It looks like a gold mine! I am a fan of Arduino and ATtiny. First of all ,congratulations to you for the tutorial quality of your videos, and also for the quality of the presentations. I take pleasure wtching you, and in the same time I improve my english ;). Given the number of videos, I have mater to occupy this wet sunday afternoon in the south east of France. I am currently working on the couple Attiny85 and ADS1115. I built for a friend of me ham radio and blind, a voltmeter in Morse code, it works really well. My friend is very happy, now he can mesure voltages!! I am currently designing release 2, voltmeter and ammeter, around a Tiny85 and ADS1115. I was very excited to perform a differential measurement (AIN0 - AIN1) on a 20A-75mV shunt (current from a 12V battery) with a gain of 16, and a classic 0-5V measurement via a resistors divider by 3 for the battery voltage. This measurement would be without gain on the port AIN2. My questions are: Can I mix the two types of measurement? And how to handle the different gain for these two measures? The two measurement wil be made only on request by pressing two push buttons. Hope you can help me to finalize my project. I am a still waiting my order (shunt + ADS1115). -- Philippe
@RalphBacon
@RalphBacon 6 жыл бұрын
Thank you for your kind words, Philippe, merci beaucoup. Regarding the measurement of both current and voltage: as you have two pairs of inputs on the ADS1115, you could use one pair for the voltage measurement (possibly using just one of the pair), but use the other pair for the current. You would have to set the configuration each time for each type (so one configuration, such as zero gain for voltage, and another configuration for current with its 16x gain). As each button is pressed the correct configuraton is loaded each time. Just make sure you NEVER exceed VDD +0.3v on any of the input pins! Good luck with this.
@tdg8934-AgonLight2
@tdg8934-AgonLight2 9 ай бұрын
Your video was spot on. I'm waiting for my ADS1115 modules to arrive from Amazon but going through the data sheet and looking at values used in your video, I modified eZ80 assembly code to test it with an Agon Light 2 computer that I plan on hopefully creating some sort of an oscilloscope for it using it's dedicated 3.3vdc power source. for it's GPIO pins on I2C.
@RalphBacon
@RalphBacon 9 ай бұрын
Best of luck! I found the ADS1115 module to work well, and as expected.
@UpcycleElectronics
@UpcycleElectronics 5 жыл бұрын
Brilliant! I like that running average code. The lcd project I mentioned a few days ago is for a volt/current meter on a little power supply. I finally just broke down to playing with a 1602 display for simplicity... but made an elaborate intro and added the first bar of the Mario theme song on a small speaker as a consolation: ) I created a different LSB averaging setup using the uno's ADC. I was debating using an ATmega8, but I am using too much memory with my technique. I'll have to try the running average method now after watching this :-) The way I've done it I am taking 10 ADC readings and placing them in an array, then taking an average of these 10 and placing it in it's own variable. I have a total of 5 sets of these arrays. The differences between the 5 average variables are used to determine if a major change has occurred. So long as all 5 averages are within a 5 digit spread (+/-2) the highest and lowest average number are replaced with the last reading from the previous run of 50 total readings. If any of my 5 averages are outside of the +/-2 digit spread the 5 actual values are averaged to create the final reading. This method seems to react quickly to intentional changes but it settles to a single least significant digit pretty fast and it stays there. This takes a lot more memory than a running average and a lot of processing time, I'm sure. I want to explore this as a precursor to building my own DAC/Arduino based power supply from scratch. It's probably going to be another shelf brick of a project but I'm determined to brick my wall if that's what it takes to learn :-) -Jake BTW a speedometer is a great illustration, but if you've ever seen a fuel gauge without it's R/C filter it's probably the worst fluctuations you'll ever see. It's amazing that an average even exists within that mess. I had a '71 Toyota FJ40 Landcruiser that had the capacitor come loose on an autometer gauge. Without the filter the gauge looks like the needle is tracking a Wimbledon tennis match. Fuel sloshing about in the tank as you drive also moves the float that sends the level for the actual gauge reading. Most people are unaware of the mechanism, but when you see it fail, it is amazing that an average even exists. ...anyways it's just a fun story I ramble about some times :-)
@RalphBacon
@RalphBacon 5 жыл бұрын
Wow, that's some "average" reading you must be getting. It certainly would be very stable and only show large changes. Interesting, I might experiment. I had a car with a speedo that varied plus/minus about 20mph, swinging back and forth. There was no chance I ever really knew what speed I was going at, but my brain took several readings and averaged them out in much the way I did it with this ADS1115. Perhaps that's where I got the idea from? Good to hear from you, Jake, thanks for posting.
@jsaturnus
@jsaturnus 6 жыл бұрын
For better S/N ratio, you could try to decouple your power near to the adc with a 100n ceramic and a 10u tantalum. And a 1nf on the input. Try to keep impedances in the circuit low values, so a 5k potentiometer will be far better then a 50 k or even 100k
@RalphBacon
@RalphBacon 6 жыл бұрын
We're on the same wavelength here, John, I feel. What you're saying is that it might be PSU noise, and/or it might be picking up signal noise (maybe even from the I2C bus). The device does have a couple of (tiny) inductors on board to reduce PSU noise; without putting a scope on it I don't know how effective they are, but it's interesting that the manufacturers thought it necessary. I'm pretty sure it could be improved in the ways you suggest, so thanks for the suggestions, useful for others thinking about this device too.
@tamasbarath
@tamasbarath 5 жыл бұрын
Ralph, I don't know what happened when you did this video, but today I tested this module. I measured the voltage of a battery after a 10k-1k divider with differential output and 1.024 Volt FSR, and I did more than 100k times. 93% of them was 1 result, and the others were in the +/-1 range. PC powered arduino clone powered ads1115 with dupont cables, without any bypassing, filtering, whatever.
@RalphBacon
@RalphBacon 5 жыл бұрын
I can only think, Tamás, that either my power supply is very noisy (I should have tried with a battery) or that other pins on the device were adding their own noise. But, it's great that you have tested this and found it very stable, that is good to know. Thakns very much for posting.
@JontyCtheKing
@JontyCtheKing 5 ай бұрын
I had the same result - hardly any deviation whatsoever despite no analog or software filtering. I couldn't believe the precision. I suspect Ralph has a noisy power supply
@Ed19601
@Ed19601 7 жыл бұрын
Very well explained. Allow me to summarize the i2c addresses: Addr to gnd: 0x48 Addr to VDO: 0x49 Addr to SDA: 0x4A Addr to SCL: 0x4B Also, found your average function with an array quite interesting, never thought of doing it like that. On Arduino I normally use something like: { byte i; int sensorval = 0; for (i = 0; i < 5; i++){ sensorval = sensorval + analogRead(z);// sensor on analog pin 'z' } sensorval = sensorval / 5; // average return sensorval; } not sure which one uses more memory
@RalphBacon
@RalphBacon 7 жыл бұрын
Hmm, I replied to this useful post, Ed, only to have it disappear on me! Computers, who'd have 'em anyway? Thanks for the additional addresses which I decided not to include in the video but it's good that they are now posted here. Regarding your averaging code, that's absolutely fine but differs from mine inasmuch that mine replaces the oldest reading with the newest and then averages out - hence the running average name. Yours averages several reads to give one averaged reading or sample, without taking previous readings into account, if that makes sense. If it works then it works, no more to be done. I suspect yours takes less memory BTW. Thanks for the post, very useful. Now I must find that "Reply" button before this disappears again...
@Ed19601
@Ed19601 7 жыл бұрын
Ralph S Bacon thanjs, has happened to me too
@jeffmartens-koop6002
@jeffmartens-koop6002 Жыл бұрын
Hi! I enjoyed the video, especially the discussion about using an array to average out the readings in order to smooth it out enough to be useful!!! I have no professional training in any of this, so please forgive me if my question reveals a ton of ignorance on my part... I dont yet know enough to intuitively sense whether or not I'm asking the right questions.... But here goes... From what I can tell, this module is exactly what I need, but I'm not measuring temperatures... What I want to do... I've got a bass guitar build in progress with a piezo transducer in the saddle of each string. I am hoping I can take the output from each piezo and send it to this board where it will (?) be amplified to a level high enough for measuring. Then, I figure the next step is to read each string's voltage several times a second and then send that information back to the main board (it is a teensy 4.0) where it will be used to generate a midi command carrying volume level instructions. The desired end result is to use the bass guitar as a dynamic midi input device... I suspect I may need to use a much smaller averaging array, because I will want to be sending a note=on command with volume and attack values as soon as the first voltage reading is taken.. ramping up the way your array does here would interfere with the goal of having the best dynamic response and control possible! (And I would want it to send the note=off command as soon as the rate of voltage drop increases by a set amount.... ^^^^^ I expect that most of what I described up above will actually be a programming issue, not a mechanical one... But before I even think too far down this path (the path here seems too good to be true!) I need to find out a really really critical thing!!! "Can this board handle the super low output of piezo transducers?" Anyway, all the best! I really enjoyed your video and appreciate the knowledge you are sharing! Jeff mk. Ps: back in the 80s, I thought having a modem for my commodore 64 was the best thing in the universe! ******* If you had told me then that some day regular people would have the opportunity to tinker with this sort of hardware, I never would have believed you. I would have sworn up and down that hooking up a temperature sensor to a circuit board and then getting the board to do "actual things" in response to the those readings... I would have said "only people with advanced university degrees will be able to access that stuff and understand it. I'm not saying I find any of this EASY or understand a lot of it, but... The fact that it is even possible.... (!!!) .. sorry this got long.
@RalphBacon
@RalphBacon Жыл бұрын
OMG! War and Peace or what, Jeff? 😁🤣😂 First things first. I would strongly recommend you have some sort of low noise preamp in the guitar to boost those tiny signals. Probably battery powered to reduce any kind of PSU noise. It should last for ages. Once the signals are boosted to something meaningful (100mV - 3V) then the microcontroller can read them in a meaningful manner. You can _try_ reading the piezo directly just on the workbench - as I haven't done it, I'm just assuming it will be super low. Like a magnetic pickup for a turntable (showing my age again, I know). Once you can read the signal properly, the rest will fall into place (you seem to have a plan).
@ericksonengineering7011
@ericksonengineering7011 3 жыл бұрын
The ADS1115 is a fine part. Check the data sheet: it says that you should get 16 noise-free P-P bits on all but the fastest conversion rates. You are seeing far more noise than that. That means you (or the board designer) are doing something that compromises the noise. Instead of averaging out the noise, you need to first get the un-averaged noise way, way down. I can see by your wiring setup what the problem is. Your input return (Ground) is at the processor, but the ADC input reutrn (Ground) is at the ADC. I2C or any other digital interface causes a large ground difference at high frequencies, even across a 100mm long wire. Your ADC input is corrupted by this digital noise. Whatever voltage source you use,(POT, Sensor, etc.) should be connected to the GND pin at the ADC, and not at the processor. Too bad that the ADC board has only one ground pin. Solder on an extra ground pin for the sensor. You'll get much lower noise. Also, please use a decent reference for the sensor, also grounded at the ADC. If you want 16 bit performance, you need a 16 bit reference. Something with drift and noise in the 100 microvolt (1 LSB) range. Any shunt or series reference, even a linear regulator, will give far better ADC performance than the USB +5V. USB +5V is one of the worst references you can use. If your CPU has a linear regulator (like a 3.3V CPU), it will also be better than +5V USB. A hack that will make your circuit perform better is to add a 0.1uF capacitor from the input to ground at the ADC. It is better to fix the grounding though. First fix the grounding, then fix the reference. Then apply filtering. A lower cost, easier to solder, 16b ADC is the MCP3428. It's slower though. Check my web page www.djerickson.com/leoled -- Dave "It's (almost) always the ground" Erickson
@RalphBacon
@RalphBacon 3 жыл бұрын
Thanks for your most informative reply, Dave. What you say makes perfect sense (and I had that niggling doubt in the back of my mind).
@ericksonengineering7011
@ericksonengineering7011 3 жыл бұрын
@@RalphBacon No problem, glad to help.
@gordondyer6310
@gordondyer6310 2 жыл бұрын
Thanks for your video Ralf and this is a very good reply to the noise issue. Since mains induced noise is a common problem I suggest doing your averaging by taking the N samples to be averaged over a 20ms period, 1 mains cycle. Also for sensitive analogue measurements you should try to screen the analogue signals from the digital with shielded cable (microphone cable), in addition to the grounding arrangements already mentioned.
@Magic-Smoke
@Magic-Smoke 6 жыл бұрын
Hi Ralph, I’ve used this on a LiFePo4 battery protection system along with an ESP8266. Works well. The noise is an issue but using the oversampling seems to be the right technique. Very reliable and fast.
@RalphBacon
@RalphBacon 6 жыл бұрын
Thanks for that, john macrae, glad it's working well (enough). Nice to hear from you.
@Magic-Smoke
@Magic-Smoke 5 жыл бұрын
@@RalphBacon I have refined the code a little now and find 4-6 mV noise which is quite acceptable for my application. One of the things I changed was to wait for the conversions to complete (see datasheet) rather than just ploughing on to get the result as soon as the configuration register is set. This came to light as I was using the Adafruit library but on ESP32 and I found that I could easily get junk results if I didn't adjust the delay required to get the result. I subsequently used your code with a delay inserted and the results improved. You can see the live system at agboat.mybluemix.net/ui/#!/0 - bear in mind that this is a live system measuring LiFePO4 batteries with normal household loads attached and running - so there is some noise from those devices.
@cellularmitosis2
@cellularmitosis2 2 жыл бұрын
Hi Ralph, a great programming exercise for you would be to implement a data structure called a ring buffer. It is specifically made to implement a rolling average.
@RalphBacon
@RalphBacon 2 жыл бұрын
I'm pretty sure I used a ring buffer when calculating the current consumption of my phone in my Smart Phone Charger (used all day, every day). I add the current (both meanings 😉) consumption to an array (overwriting the oldest value) and calculate the new average. Works like a dream. Videos #179, #193 and the code will be in my GitHub I'm sure.
@davethedaemon9024
@davethedaemon9024 7 жыл бұрын
Thanks for this. I was looking into how to measure current with the arduino (for a future power supply project) and realized I needed amplification and more resolution than the arduino could provide. That lead me to the ADS115 and your timely video. I'm new to the arduino and re-entering the electronic hobbyist world after 40 years of pure programming. This was informative. Thank you. And to have more stable measurements, perhaps add some bypass caps across VCC and ground as close to the chip as possible. I understand Arduinos are noisy.
@RalphBacon
@RalphBacon 7 жыл бұрын
Absolute Bedlam, Dave, can't hear yourself think, there's so much chatter going on what with SPI, I2C, USB... yes, I suspect that a decent power supply and maybe shielded cables might solve the 'noise' issue (or at least improve it). Glad that this was a timely video for you; funnily enough, I'm also considering a power detector for a kettle we have that has no light but I just need on/off detection so a standard PIC or Arduino will work fine. Thanks for posting!
@TYGAMatt
@TYGAMatt Жыл бұрын
Ancient video, but good stuff on not using a library. I've always just used the Adafruit library but my latest project requires speed and the library is rather slow. Switched to the ADS1115_WE library and much faster the my previous code. But I'm thinking now to just use the wire library and be done with. I'll have to give it a try and compare times. Thanks Ralph. Always gold on your channel. Cheers Matt
@RalphBacon
@RalphBacon Жыл бұрын
There be gold in them thar hills (well, UK).
@TYGAMatt
@TYGAMatt Жыл бұрын
@@RalphBacon I live in Thailand now, but hail from Bucks. Spent much of my youth playing in the Chiltern Hills....no gold there I can assure you :-)
@whitefields5595
@whitefields5595 4 жыл бұрын
Thanks Ralph. Very well explained as usual. Good that you did not use a library. Forces us to think more! I'm about to start measuring AC mains with current transformer so will measure the + and -ve waveform of AC as this ADC allows + and _ve inputs. You on the Naughty Step, are not allowed to work on mains stuff. I will keep you informed, if I live:))
@RalphBacon
@RalphBacon 4 жыл бұрын
If you let me know where to send the flowers... Uncanny that I was thinking of you yesterday, or more correctly, your absence from my channel. I wondered if it was because I was not playing about with mains voltages that you have not commented lately? Anyway, I hope you survive and continue to watch my videos as I still have not shown my new mains isolation transformer (not new anymore) that can be safer than working directly on the mains. But on the other hand, I have so many low voltage projects on the go it may be some time (Thank goodness, I hear you say). Nice to hear from you, I hope you are keeping safe.
@whitefields5595
@whitefields5595 4 жыл бұрын
Ralph, Real World project for me is measuring AC mains current. (I know I don't allow you near mains unsupervised). I am building a display system to show the import/export rate from my solar panels. I am using a current transformers on my mains input to my house and from my solar panels. I buffer, amplify, rectify and then peak detect the AC waveform from the CT with op amps. All is nice and stable and linear. I have copied your work here and can confirm that while the ADS1115 may have far more resolution it does need a lot of coding to smooth out the input. Not being able to measure zero is troublesome too! In my case the op amps drift BELOW zero and that gives the ADS1115 a headache and sends it fully high. Even if I ground it and put it in a Faraday Cage it wanders around. Are you sure some of these other settings don't need tweaking? Finally check your lights wall warts and other PSUs in your shed, they do throw off a lot of interference! I will pass the project on to you when I have got it stable as there is much to learn measuring alternating signals with analog devices. DC, after all, is easy?
@RalphBacon
@RalphBacon 4 жыл бұрын
Is the power being supplied to the ADS1115 squeaky clean? That will have a major effect on its stability and ability. Funny you should mention this, I've just been sorting out how I can smooth out the power from a 5v PSU to my Smart Phone Charger, might turn into a video.
@whitefields5595
@whitefields5595 4 жыл бұрын
@@RalphBacon Thank you for responding. I've sorted it now. btw I repeated your video with a 10k pot drawing power from the Arduino regulated supply which also powered the ADS1115. I got a stable reading across the range (on calibration 000 = 6.144V) It is rock steady and I also get a stable zero. I did not need to use your rolling average code ... so suggest you try this to to prove that the ADS 1115 is perhaps more stable than you may have thought. As for my mains monitoring I cannot (yet) tune out the interference from the current coil at zero ... it is an antenna after all and the signal to noise ratio of my amplifier makes it worse. With the ADS 1115, if you put negative spikes on it, it then flips all the way to +64000. So. reluctantly, I have put an offset into the ADC (convertedValue-zeroOffset) which gives me a 'zero' a few digits north and prevents me going full high.
@Tom_Seeker
@Tom_Seeker 3 жыл бұрын
I wonder where the fluctuations come from? Definitely not from ripples in supply voltage right? This chip has voltage reference so it should be stable unlike Arduino's ADC which basically references its 5V supply.
@RalphBacon
@RalphBacon 3 жыл бұрын
Probably just noise from the unshielded cables and/or the power supply being used. Someone else commented they have no noise with a better PSU and shielded cables.
@VasilisKarastergios
@VasilisKarastergios 7 жыл бұрын
I like the way you explain how things are working, I really learned a lot from you! Greetings from Greece.
@RalphBacon
@RalphBacon 7 жыл бұрын
I'm glad you think that Vasilis, and greeting back from cold, wintry England! Roll on the warmer Spring weather!
@VasilisKarastergios
@VasilisKarastergios 7 жыл бұрын
We get around to 300 days of sun here, today the thermometer says 17celcius. Keep the spirits " HIGH " spring is on it's way!
@RalphBacon
@RalphBacon 7 жыл бұрын
17 Celcius, that would be considered a heat-wave here! Ha ha! Yes, spring is around the corner, another month or so. At least there is no actual snow on the ground at the moment...
@DanielMelendrezPhD
@DanielMelendrezPhD 5 жыл бұрын
Really concise and educational. Thanks for your work, Ralph ;) Cheers!
@RalphBacon
@RalphBacon 5 жыл бұрын
Really good you liked it, Daniel, thanks for posting.
@theralhaljordan7337
@theralhaljordan7337 5 жыл бұрын
uploaded your code and when I connect A0 to GND the value jumps up to 65534. do you know why this is? and from 4.5v supply the max input it can read is about 4v. is this normal?
@theralhaljordan7337
@theralhaljordan7337 5 жыл бұрын
played around some more with a potentiometer. when I lower the voltage to 0.08 the output is 694, if I keep dropping the voltage it rises to 65534 when I go to ground. And it reaches the max output (32767) at about 4.13V. I have a series of small caps filtering out the 4.5V supply, and looking on the oscilloscope there is very little fluctuation oooh got it to go down to 2 at 0.5mV. still annoying that it shoots up to 65534 at ground though. could deal with this is software, maybe my chip is just defective. I'll order a couple more and compare
@RalphBacon
@RalphBacon 5 жыл бұрын
It's not being affected by the other (unused) inputs is it? Deffo sounds odd.
@theralhaljordan7337
@theralhaljordan7337 5 жыл бұрын
@@RalphBacon nope, only reading one input on A0. I was hoping to use this chip for processing guitar audio signals, but I'll just have to use the 10 bit resolution of the atmega ADC till I find a chip with less noise and issues
@theralhaljordan7337
@theralhaljordan7337 5 жыл бұрын
people seem to be happy with it on amazon reviews. maybe there are chinese counterfeits?
@RalphBacon
@RalphBacon 5 жыл бұрын
Another chip you can try is the LGT8F328P (I did video on it) which has 12-bit analog inputs (and comparators, I believe) although the accuracy tails off at higher voltages. Have a look at the data sheet. This was in video #156.
@DavidMsg
@DavidMsg 2 жыл бұрын
Using the ADS1115 for a germanium transistor tester, and also seeing noise. I think it could be the module itself- off aliexpress, so could be a fake TI chip. Have you tested with an adafruit unit?
@RalphBacon
@RalphBacon 2 жыл бұрын
I cannot remember where I got my device, but probably China as Adafruit are generally more expensive (probably because they use genuine chips).
@Omgtired
@Omgtired 2 жыл бұрын
Thanks for the video, great stuff! But I don't understand why do you use unsigned char for the indexes of arrays, and how that even works!
@RalphBacon
@RalphBacon 2 жыл бұрын
I don't remember the exact use I put an unsigned char to, but these days I tend to use the _uint8_t_ for a 1-byte unsigned integer (0-255), as that is more descriptive. Just to clarify the _char_ use; a char is, by default, signed and can hold values from -128 to + 127. An _unsigned_ char holds between 0 and 255. Just like the uint8_t (unsigned integer 8-bits type). But whereas uint8_t is very clear about its size and signed-ness a char is not. Better to use uint8_t and int8_t where possible.
@Omgtired
@Omgtired 2 жыл бұрын
@@RalphBacon thank you for your response!
@tablatronix
@tablatronix 7 жыл бұрын
Did you try measuring a voltage? pots are very noisy themselves.
@RalphBacon
@RalphBacon 7 жыл бұрын
I didn't but I agree they can be. But just approaching the unit was enough to make the signal dance all over the place so I suspect it was more than just noise on the line. Shielded cable might have helped. I guess having such a high sensitivity is going to be one of the drawbacks to a stable reading. There are some good suggestions in the comments here but fellow Arduinites.
@md.mostafakhan4529
@md.mostafakhan4529 4 жыл бұрын
I bought a few of these ADS1115 some days ago. They all have the designator "BOGI", but they are giving 11 bit results. I used the library from Adafruit, commented the ADS1015 setup and enabled the ADS1115 setup. I chocked the library code but that looked alright too. Don't know why they are giving '0000" for the last 4 lwast significant bit. Saying because if I use the IC with ADS1015 code then it gives 11 bit results, and when I try ADS1115 code it gives 15 bit value but each one 16 step apart. So its giving like 0, 16, 32,.....
@RalphBacon
@RalphBacon 4 жыл бұрын
If I recall correctly there was some caveat about using these in the most sensitive ranges - best to read the datasheet to see what is stated there.
@SuperNova153
@SuperNova153 3 жыл бұрын
Thank you very much for the presentation! I learned quite a bit and this is extremely helpful for my current project. Comprehensive and very clear information.
@RalphBacon
@RalphBacon 3 жыл бұрын
Glad it was helpful!
@asagk
@asagk 6 жыл бұрын
Did you try to use a small averaging cpacitor on the analog input as a filter, to get rid of noise right at the input of the ADC, like some few pF ceramic disc cap? (in the range of 1.2 to 22pF perhaps?) I personally tend to believe that voltage controlled oscillators along with frequency counting (capture hardware component) makes a better choice to measure analog values, because it is much more resilient to environmental noise, as well as it can be temperature compensated by choice of components much better than some integrated ic. But the downside is, there is no low power solution in the range of uAmpere when using a VCO approach. The problem you pointed out with this integrated higher resolution ADC is a pity, but seems to be very common with such integrated cheap to go ic.
@RalphBacon
@RalphBacon 6 жыл бұрын
No, I didn't try that capacitor as far as I know (this was a little while ago now), if I get this device out again I'll give it a whirl. Thanks for the suggestion.
@laliborio
@laliborio 4 жыл бұрын
I wish I could have had you, sir, as my professor.
@RalphBacon
@RalphBacon 4 жыл бұрын
You are most kind to say that, Luis. I hope you are learning from my videos!
@laliborio
@laliborio 4 жыл бұрын
@@RalphBacon I'm learning a lot indeed :) Thank you very much!
@thomasmv5986
@thomasmv5986 5 жыл бұрын
how to add 2 pots for the same sketch
@RalphBacon
@RalphBacon 5 жыл бұрын
Use a loop function that checks each pot value one after the other.
5 жыл бұрын
I've used this in my off grid solar data logger (2 of them) they measure voltages and amps going from pv to batteries and to ac using acs712 for ac and acs770 for dc on my custom pcb. though I've only setup the battery voltage reading, deployed it and didn't bother to add the rest of the components and program the rest of it (as one with 20 projects going at the same time does)
@RalphBacon
@RalphBacon 5 жыл бұрын
Sometimes it is _time_ that is our enemy in doing our projects but at least yours is working nicely using the ADS1115, thanks for posting, Pawel, nice to hear from you.
@Tom_Seeker
@Tom_Seeker 3 жыл бұрын
How did you manage to measure a battery >6 volts with ADS1115? some voltage divider or what?
3 жыл бұрын
@@Tom_Seeker yes, 1M/200K to measure 2S AGM batteries (up to 30V) and then added a calibrator value to hone in on the voltage
3 жыл бұрын
Hi! Great walkthrough, thank you! I am actually quite familiar with the chip and the programming part, but I encountered another challenge with this circuit. I am using it in differential mode (A0-A1 and A2-A3 pairs as inputs), and I found the input impedance to be too low for my application (it draws too much current which messes up everything). I came up with the idea to use some op-amp-based voltage follower which works great if I limit the input voltage between VCC and GND, but I also need the negative voltages. I used a voltage follower on both input pins (let's say A0 and A1), but the values are incorrect. Something suggests me that the problem is that I am using a single supply op-amp which might also limit the voltage towards the negative side of the range. With the ADS1115 board itself, I can utilize the full +/- range, but not with a voltage follower added before it. Do you have any insights on this topic? Thank you!
@RalphBacon
@RalphBacon 3 жыл бұрын
You've already suggested a few points that might be causing you grief, David, and I have nothing more to add. I'm not currently using the ADS1115 so can't even see what I did, sorry. But good luck with getting a solution in due course.
@fredgibson5739
@fredgibson5739 2 жыл бұрын
CODING PROBLEM Thanks for your very interesting video. I have ordered a couple ASD1115 and looking forward to lots of fun. Line 76 of your sketch has me foxed. Can you explain it for me please. I don't recognise the ? and cant find any info on the web
@RalphBacon
@RalphBacon 2 жыл бұрын
I'm almost certain you are referring to THIS line: readCnt = readCnt == 19 ? 0 : readCnt + 1; This is known as a ternary operator (because there are three parts to it). It's a shorthand form of "if else". If I were to translate the above statement it says: 1. Assign variable readCnt to... 2. If readCnt is already equal to 19, then set it to 0 else 3. Increment readCnt by 1 The format of the statement is: variable assignment = (condition is true) ? this value : else this value; Here's some bedtime 📖 reading for you: www.w3schools.com/cpp/cpp_conditions_shorthand.asp Hope this helps!
@jfsaraceno9265
@jfsaraceno9265 4 жыл бұрын
Excellent tutorial on this little feature packed chippy. Thank you for the walk through and the low level code that you provided. I am operating the ADS1115 in 16x gain mode. One question I have is when using the chip in this mode (+/- 256 mV) for sampling low level signals, the resolution is 16 counts. For example, when varying the input with a trimmer, the minimum change in output is 16 counts. Is this the expected behavior (resolution is simply gain * LSB, so 16 counts for 16x gain mode? I was expecting the full 16-bit range across the +/-256mV at 0.0078125 mV/count resolution, but in practice the resolution is 16x higher than this, at 0.125mV/count. That doesn't seem to get me as much resolution that I had hoped.
@RalphBacon
@RalphBacon 4 жыл бұрын
At higher bit resolutions you will find many chips give less than what you might expect. The datasheet should give you the full picture, ie what the minimum resolution can be and how to achieve that.
@JoshMichael
@JoshMichael 6 жыл бұрын
Can you have two of these wired at the same time to get 8 channels?
@RalphBacon
@RalphBacon 6 жыл бұрын
You can have up to four of these devices wired up to get 16 channels if you want! The address is determined (did I not mentioned this in the video?) by connecting the ADDR pin to nothing (same as ground) or one of VCC, CLK or DATA, strange as that might seem. That determines the I2C address the device gets. Any good?
@drakkorvladimir4012
@drakkorvladimir4012 4 жыл бұрын
I am having trouble with mine. When my pot is zero/left, my reading jumps between zero and 4096. Everything is coded right but it keeps doing this. Help? : )
@RalphBacon
@RalphBacon 4 жыл бұрын
It could be the pot. When in the extreme left (or right) position the slider (the bit your are rotating) might actually come off the track so instead of it being zero it's now maximum (infinite) resistance. Try swapping the left and right connectors (so it's now backwards to see if it still happens). And/or try a different pot. Let me know!
@drakkorvladimir4012
@drakkorvladimir4012 4 жыл бұрын
@@RalphBacon Thank you. I thought of that but it didn't make a difference and it was in the zero end of the pot. I 'think' I may have found the problem but am not sure, and I definitely do not have anywhere near your knowledge on this. I think it was a conflict with the TM1637 4 digit led tube I was using for my readouts. I was only using one single ended channel and and one TM1637 at the time. When loaded up and running, even the serial monitor would jump around. It may also be something about a neg voltage from the pot, but tried many pots and still the same. Thank you for actually replying, I appreciate it a lot. Maybe, if you ever feel like it, you can try this and see what you can figure out? Have a great weekend : )
@drakkorvladimir4012
@drakkorvladimir4012 4 жыл бұрын
@@RalphBacon Oh boy........I feel so stupid and wasted so much time . You were correct but the bad part turned out to be my breadboard. Got so mad that I took the bottom off and ground rail had a cracked path which mainly seemed to affect the ground on the ADS1015. Now I have to try a new breadboard and un-learn all that I 'thought' was wrong. Thank you so much for all the help : )
@eligijuspranskunas3509
@eligijuspranskunas3509 Жыл бұрын
Hi Ralph! great video, but I can't figure out - how to get another 3 analog readings?
@RalphBacon
@RalphBacon Жыл бұрын
Hang on, just got to plug in my memory module (archive 761) from 2018... ah, right! Now I remember... sort of. So you have configured the ADS1115 using I2C and have read one analog reading by similar to: int sensor0 = adc.readADC(0); So to read something from the other 3 inputs, just do: int sensor1 = adc.readADC(1); int sensor2 = adc.readADC(2); int sensor3 = adc.readADC(3); Make sense? To prove it is working just do a Serial.print for each variable. Remember to convert the int value to an output voltage (if you need to) by: float myVoltageValue = ads.toVoltage(X); // X = sensor pin number Serial.println(sensor1 * myVoltageValue, 3); // or however many decimal places you want --- You can also change the gain, but I'm sure this is covered in the video; if not, then Google is your best friend! ads.setGain(0);
@eligijuspranskunas3509
@eligijuspranskunas3509 Жыл бұрын
@@RalphBacon well that will work with having library. but question was in regards of this video(no librarys used) i mean- which bits need to change to choose different channel?
@RalphBacon
@RalphBacon Жыл бұрын
You don't ask the easy questions, do you, Eligijus? My brain hurts. 🤯 OK, in my demo sketch, if you look at the config description (lines 27 - 33) it says that bits 14:12 of this register control which input (ANC) we are reading. As this is a MSB high end byte, the binary value of 0b01000010 in my code has 100 in those bits set (from the left), which means we are reading input ANC0. The list is: Binary Setting ANC 100 0 101 1 110 2 111 3 Thus, if you want to read, say, ANC2, change that first (MSB high end) byte on line 33 in my example from 0b01000010 to 0b01100010. Leave the LSB alone (described in lines 35-43) unless you want to change the data rate or comparator mode etc. Give it a whirl but do check my bit settings!
@eligijuspranskunas3509
@eligijuspranskunas3509 Жыл бұрын
@@RalphBacon thats the answer! :D thank you a lot :)
@RalphBacon
@RalphBacon Жыл бұрын
Glad it helped! Good luck with your project 👍
@onlinehayyan
@onlinehayyan 4 жыл бұрын
a massive Thanks for this wonderful Video. According to your configuration and information, if the continuous mode is applied, that's mean I can only read from one Input. my question: how can i read 4 analog inputs with sampling rate (860 sps)? is there any way to apply the following scenario: 3 ADS1115 converters .... connected to Arduino each with different Address (0x48, 0x49, 0x4A)...... Arduino should read 4 inputs from each ADS with sampling rate=860 sps ? Thanks in Advance for your Help
@RalphBacon
@RalphBacon 4 жыл бұрын
Depending on how you configure the ADS1115 you get 4 single ended inputs or 2 differential. All over I2C and up to 860s/sec. If you connect further ADS115s to I2C with different addresses you should be able to read each module sequentially. As the datasheet states, "The address can be changed to one of four options (see the datasheet table 5) so you can have up to 4 ADS1115's connected on a single 2-wire I2C bus for 16 single ended inputs." As long as your sketch "keeps up" it should be fine. If you need a faster processor these also work on ESP8266s, ESP32s and, of course, Raspberry Pis - in fact any I2C capable processor!
@ArunJayapal
@ArunJayapal 2 жыл бұрын
I am interested in a video about SCT013 which is used in conjunction with ADS1115. This video was informative.
@RalphBacon
@RalphBacon 2 жыл бұрын
I'm glad it was of use to you.
@arunantony8786
@arunantony8786 6 жыл бұрын
Rather than discarding the whole sample after division you could just shift it one place(after each adc sampling) so the new sample gets added at the bottom of the array. That,s more smooth. The method you mentioned gives output only after five samples meanwhile the above mentioned method outputs after each sampling
@RalphBacon
@RalphBacon 6 жыл бұрын
That's a good suggestion, Arun, and I will make a note of that so I have it to hand if I revisit this device. Thanks for posting.
@javierpallalorden
@javierpallalorden 7 жыл бұрын
Hi Ralph, If you want something different you should try the ADS1118, it allows you to measure two differential or four single-ended inputs and a few other nice to have things.
@RalphBacon
@RalphBacon 7 жыл бұрын
The ADS1115 also allows 4 single-ended or two comparative input pairs, but as I said in my video I think we Arduinites would prefer to use this device as 4 (further) analog inputs, which is what I concentrated on. I didn't realise they had extended the family to the ADS1118 so I will take a look, thanks very much for the heads up.
@pekkagronfors7304
@pekkagronfors7304 7 жыл бұрын
Great again Ralph. Very interesting reasoning about this type of product. Thanks.
@RalphBacon
@RalphBacon 7 жыл бұрын
Thanks for that, Pekka Grönfors, nice to hear from you again.
@FlySweden
@FlySweden 4 жыл бұрын
Hello, Could I use an Arduino Pro Micro (10bit resolution) with the ADS1115 (16bit resolution) to build a joystick (with better sensivity) that uses some hall effect sensors with magnets ? Thank you !
@RalphBacon
@RalphBacon 4 жыл бұрын
Probably. Just remember that at the higher resolutions the steps between values is bigger and you will get a lot of jitter - but it will be better than the 1024 steps you get with the standard Micro. I would do a proof-of-concept on your workbench first, just to make sure it behaves the way you want.
@FlySweden
@FlySweden 4 жыл бұрын
Ok I got it. I will now try to determine the wiring and code ! Thanks again !
@jamescullins2709
@jamescullins2709 7 жыл бұрын
Ralph, can you use the diff inputs and bias it to 1/2vcc to pick up the minus bit. Then use map() to scale to single end output.
@RalphBacon
@RalphBacon 7 жыл бұрын
Intriguing idea, James. So we have a two-input comparator set to, say, 2.5v that can then effectively measure -2.5 to + 2.5v. The resulting (positive) figure we map from -1000 to +1000 (for example) as the map() function does handle negative ranges. Hmm, is this how you thought it might work?
@jamescullins2709
@jamescullins2709 7 жыл бұрын
Yes it is. or in my case 0 to 4096 (12 bit) as a 0 to 300v.
@kendrickapps674
@kendrickapps674 6 жыл бұрын
Hi I built a similar circuit to yours as a test for an upcoming project, instead of pins I soldered between the pot and the ADS(the I2C was pinst hough). I used a 20 turn trimmer pot. The results were a lot more accurate. Your code will help me when I come to do the upcoming project. I want to use the ADS1115 as 4 separate a to d converters, none of the information I have read explains how to read the other analog pins on the board could you explain.
@RalphBacon
@RalphBacon 6 жыл бұрын
There's an example sketch from Adafruit which shows a 4-input single-ended example, is that what you're looking for perhaps, Kendrick? You will have to use their library too, of course. learn.adafruit.com/adafruit-4-channel-adc-breakouts/arduino-code Interesting what you said about a multi-turn pot, I shall bear that in mind. Thanks for posting.
@vivekvenkatsubramaniam437
@vivekvenkatsubramaniam437 5 жыл бұрын
There's a lot of noise in that one chip, so wouldn't it be even noisier with 2 chips in the same i2c bus? I've seen suggestions on using caps to reduce the noise, how effective is it for 2 such chips?
@RalphBacon
@RalphBacon 5 жыл бұрын
I think seriously decoupling that chip will address the noise but that will require a small amount of work. I'll bear it in mind when I next dig it out.
@sockSandals
@sockSandals 4 жыл бұрын
Good tutorial. I have bought ADS1115 boards from Ali. They do not all have the same quality Texas Instrument chip on them. Based on the close inspection of the marking the Texas icon is very poorly done ON MOST. The board produced by TENSTAR ROBOTIC operates flawlessly. Other boards seem to work 1 out of 3 . They miss taking a correct reading ever so often .
@RalphBacon
@RalphBacon 4 жыл бұрын
Thanks for the info! That is the risk we take in ordering from dubious markets, I guess.
@sockSandals
@sockSandals 4 жыл бұрын
@@RalphBacon here is the link to the source that supplies the Tenstar Robotic units. www.aliexpress.com/item/32764737667.html?spm=a2g0s.9042311.0.0.583a4c4diZVXU4
@anders4u222
@anders4u222 7 жыл бұрын
Try measuring the voltage of a battery, then you can tell if it’s noisy or not.
@RalphBacon
@RalphBacon 7 жыл бұрын
Coincidentally I just replied to ElectronicWizard on the same subject, more-or-less, so you could read the answer there, but safe to say I got fed up trying to work out where the noise was coming from and then having to 'fix' it anyway! Good suggestion, Anders 4u2, good to hear from you.
@tad2021
@tad2021 7 жыл бұрын
Using RMS seems to be a common way to handle the noise on these. I had planned to use that approach on a project of mine that was using some of these but shelved it to work on other projects before I got around to redoing the code for it.
@RalphBacon
@RalphBacon 7 жыл бұрын
I've been reading a few articles about RMS calculations to handle noise since your post, TAD2020, but it got very mathematical, very quickly. If you have a beginners' guide web page link or similar that would be good not just for me but for everyone reading your post. Or, of course, a quick summary by yourself! Intriguing, to say the least, thanks for the heads-up.
@ThylUlenspiegel101
@ThylUlenspiegel101 4 жыл бұрын
Hi Ralph, thanks for good tutorial. A quick question - is it necessary to perform configuration on ADS1115 in each iteration of the loop or it should be done just once?
@RalphBacon
@RalphBacon 4 жыл бұрын
I'm looking at the "ADS1115_ADC_16_bit_SingleEnded.ino" sketch and it all has to be done in the loop( ) as we do three separate things in each iteration. Was this the sketch you were referring to and did this answer your question, Roman?
@ThylUlenspiegel101
@ThylUlenspiegel101 4 жыл бұрын
Ralph S Bacon Yes thanks for the quick response
@kendrickapps674
@kendrickapps674 6 жыл бұрын
Hi I am using this in a real world application using your code as a base. I’ve created a battery monitor for my ebike measuring the amps and the volts. I found out the hard way a few things :- 1 for the voltage divider use a 20 turn trim pot not a pair of resistors(through hole) 2 use separate asd1115 for the amps and volts. Kendrick
@RalphBacon
@RalphBacon 6 жыл бұрын
Excellent news, Kendrick and congrats on getting it working. When you say "the hard way", that's what's called "experience" and can't be taught. It's acquired through hours of painstaking effort, sometimes spending a bit of money along the way. But it's lessons that are not easily forgotten. I applaud you for doing this and I'm happy my video provided a base from which to start. Thanks for the information and the post.
@raedabdo1601
@raedabdo1601 5 жыл бұрын
Can you provide a sketch of the pin connections? I am not sure why its not working for me :(
@RalphBacon
@RalphBacon 5 жыл бұрын
Of the ADS1115 device, Raed? Just Google it. Or do you mean the wiring between the µController and the device? I've only used the I2C bus. If you're having problems try running it on an Arduino and run the I2C scanner program to make sure you're using the right Hex Address. You can find the scanner sketch here (I've just added it): github.com/RalphBacon/ADS1115-ADC
@Zhixalom
@Zhixalom 4 жыл бұрын
I can't help but wonder, is there any particular reason why you wrote this line like that? Serial.println(convertedValue >> 6
@RalphBacon
@RalphBacon 4 жыл бұрын
It was to show that we bit shift the value right 6 positions and then left again 6 positions thus clearing out those values. But your alternative ways are fine. As long as we comment what we are doing it's good to use different methods some times!
@Zhixalom
@Zhixalom 4 жыл бұрын
​@@RalphBacon ​ It is obviously both system- and language-dependent. But believe it or not, I have encountered issues where it wasn't immediately clear which kind of bitwise shifting would be used. Whether it would be scrolling, which dumps the bit going out into the void, or rolling, which stuffs the bit going out back in at the other end, or some of the various instructions which push the bit going out onto one of the CPU-flags and the bit occupying the flag back in at the other end. I guess it is only something we need to be aware of if we venture into other systems and language-dialects. In this case, using the bitwise logic instructions like the infamous NOT, AND, OR, XOR etc. for clearing and modifying bits, is a lot faster in terms of CPU cycles, as they can do the job in one single cycle, which otherwise takes the bitwise shifting instructions one cycle per bit scrolled back and forth. This may not seem to matter much in this world of 64-bit multicore processors running at several gigahertz. For any Raspberry Pi, this is such a small drop in the ocean, and you might not feel it much either on an STM32 or an ESP32. But on the smaller MCUs like the standard Arduinos every bit, byte, and CPU cycle saved can be felt in terms of efficiency and performance. The closer we get to the speed and resources of the old micro's from the '80s and early '90s, the more these kinds of things actually do matter.
@BAEX2013G
@BAEX2013G 4 жыл бұрын
Could you show your wiring diagram please?
@RalphBacon
@RalphBacon 4 жыл бұрын
Here's a description (colours refer to the Dupont cables I used in the video): *UNO/Nano ADS1115* SCL (Orange) SCL SDA (Yellow) SDA GND (Brown) GND +5V (Red) VDD GND (Black) to one end of pot (probably 10K) VIN (White) to other end of pot Blue wire from pot wiper (centre) to A0 on ADS1115 I hope this helps, Tim, and your comment has made me realise that I must include a proper diagram in my videos on future, sorry this was missed.
@fashabeechannel6824
@fashabeechannel6824 2 жыл бұрын
Thank you so much. I'm waiting for this tiny module to sovle unstable value from my sensor. Hope it works. Thanks again!
@RalphBacon
@RalphBacon 2 жыл бұрын
Best of luck! I'm sure you will be fine.
@chrisgosling5408
@chrisgosling5408 3 жыл бұрын
I think Adafruit should give you a high paid job as this code is so much better than theirs. The configuration of the of the ADS1015 allows you to realise the full potential. I now have two 12 bit channels running at 1kHz sample rate. Many thanks Ralph!
@RalphBacon
@RalphBacon 3 жыл бұрын
Thanks for sharing! Glad you got this running.
@SpeccyMan
@SpeccyMan 7 жыл бұрын
One thing that might be interesting to try is, instead of just taking the mean, you could also take the median and the mode and see if there is more or less jitter in the results. Spoiler alert! Next video on the 12-bit DAC board perhaps? (I've been playing with an MCP4725 breakout board myself) ;-)
@RalphBacon
@RalphBacon 7 жыл бұрын
Yes, I could have done that, Nick, and several other things besides it seems from the excellent suggestions in the video comments that I've received. It just seems a shame to have such a sensitive module being "downgraded" due to the noise/jitter. But it's still many times more sensitive than the 10-bit Arduino even with running averages and so on, don't you think?
@SpeccyMan
@SpeccyMan 7 жыл бұрын
Well, I find myself becoming more and more fascinated with the "Blue pill" STM32 board with its 32 bit ARM Cortex M3 microcontroller (64Kb Flash 20Kb RAM) and clocked at a speedy 72MHz. It has 12 bit ADCs and DACs amongst a host of other exciting peripherals. I'm also playing with a Discovery board that has an ARM Cortex M4 on it (so in addition to a shedload of gadgets it also has a floating point unit.) The Blue pill is nicely supported in the Arduino IDE with the addition of a plugin. My dream of building my own flight controller board for a quadcopter carries on ....................
@lightfoot42051
@lightfoot42051 Жыл бұрын
I was able to get extremely close readings by lowering the Data rate to 8 -16 or even 32: ADS1115_DR_16_SPS
@RalphBacon
@RalphBacon Жыл бұрын
Thanks for sharing that information, Clifford. when you say "extremely close", how close exactly?
@eloonano
@eloonano 5 жыл бұрын
Do you know how to use the ADS1115 with a PIC? Thanks!
@RalphBacon
@RalphBacon 5 жыл бұрын
I've never used this with a PIC, I'm afraid, Mariano, sorry. I've left the PIC behind many years ago now so it's all fading from my memory too.
@Ed19601
@Ed19601 7 жыл бұрын
As I seem not to be able to reply to yr comments, I will just make it here,: Stupid of me to not have realized your code was a running average, but I guess I was more focussed on the main lines. Nevertheless, will keep yr section of code in case I need a running average. Curious to see which one in the end would give a more accurate outcome. I have one of those 1115 modules, but had no time yet to do something wih it, still building something with the PCF8591 that you did an earlier video on. I appreciate you redid your disappearing comment
@RalphBacon
@RalphBacon 7 жыл бұрын
Yes, KZbin does sometimes do some funny things (and, no, I'm not referring to letting me upload my videos!). If you ever do anything with the ADS1115 then please do return and share your experiences. Thanks for persevering with your comments, Ed, always nice to hear from you.
@thegoodhen
@thegoodhen 5 жыл бұрын
This level of noise is kind of to be expected. I have spent countless hours trying to eliminate noise and get a usable resolution from a 24 bit ADC. I ended up getting around 17 to 18 bit effective resolution. First off, you are taking a few measurments and then doing nothing for 250ms! I suggest instead taking many more consecutive measurments and then calculating an average, not wasting your time waiting. When doing that, be careful so that you don't introduce additional inaccuracies caused by finite resolution of floating numbers (try to avoid floats if possible, I see that you have, but it's another gotcha). You might also find that averaging samples in such a way so that the total period over which you measure them is an integer multiple of the period of your mains power will work wonders, since mains (50/60 hz, depending on where you live) is the biggest source of noise. Ground return paths are a huge noise source. The high resistance of your wires is not helping your cause at all. Ideally, you should have just one single ground connection for both your potentiometer and your ADC! Also, the fact you are basically measuring the noisy Vcc of the Arduino doesn't really help at all... You are getting noise frequencies on the input that are far beyond the sampling frequency of the ADC. Add a capacitor between the wiper terminal of the pot and the ground! Powering the Arduino from 12V, using the internal linear regulator might also help, but then you probably wouldn't be able to see the measurments. :D What I did was I designed an active filter to first smooth out the power supply (capacitance multiplier) and then used 2 separate linear regulators to provide 5V to the Arduino and to the ADC. I then used a small value resistor (10 ohms) to create a lowpass filter to further filter out the voltage for the ADC. I added the small filtering capacitor to the input, as mentioned. This was actually done on a different ADC (MCP3903), but I think the same principles apply.
@RalphBacon
@RalphBacon 5 жыл бұрын
Excellent information. It sounds like you have tried (successfully) to eliminate most noise using the methods you outline above. I shall bear your methods in mind the next time I have an issue of this type.
@thegoodhen
@thegoodhen 5 жыл бұрын
@@RalphBacon No problem. I forgot to mention it, but the fact you are measuring the noisy 5V line against a stable reference is by far the worst contributing factor to the low stability of your readings. A simple fix would be to plug the potentiometer into the 3.3V pin of the Arduino, where it's filtered by the regulator circuitry. In my experience, this alone should improve your effective resolution tenfold.
@theralhaljordan7337
@theralhaljordan7337 5 жыл бұрын
have you checked out the "simple kalman filter library"
@theralhaljordan7337
@theralhaljordan7337 5 жыл бұрын
or you could AND the value with a 11110000... etc the number of least significant bits you want to make always "0". would lower the resolution of course but remove the oscillation. probably could do that with the config register too but I'm still learning how to use the ADS1115
@thegoodhen
@thegoodhen 5 жыл бұрын
@@theralhaljordan7337 Thats a workaround at best... You need to get rid of the aliasing noise in hw and then get rid of the rest in sw. What about Kalman filters?
@jamescullins2709
@jamescullins2709 7 жыл бұрын
Thanks for a great tutorial, I only needed 12bit so switched to ADC121c021, If I need more than one channel I will revisit the chip. I had noise plus didn't like dropping from 12bit to 11 in single endmode.
@RalphBacon
@RalphBacon 7 жыл бұрын
Yes, dropping to 11 bits is only one bit more than the standard Arduino gives you, so I can understand where you're coming from. Thanks for that, James Cullins, nice to hear from you.
@jamescullins2709
@jamescullins2709 7 жыл бұрын
Thank you for a quick response. I do like your coding and am learning each time I view one of your videos.
@RalphBacon
@RalphBacon 7 жыл бұрын
Thank you, James, and do keep tuned!
@EmmanuelAyegba
@EmmanuelAyegba 7 жыл бұрын
Thanks for another great tutorial Ralph.
@RalphBacon
@RalphBacon 7 жыл бұрын
Thanks for your post, Emmanuel Ayegba, good to hear from you.
@rtilt143
@rtilt143 4 жыл бұрын
Really enjoy your content. Always learn something new. Quick question please, when providing power and ground to the ADS1115, is it mandatory that VDD and GND on the ADS1115 use connections (power and ground) from the MC? I'm using an ESP32, which does have 3.3 and ~5.0v available, but I also have an actual 5.0v (and ground) from a regulated source, that I would prefer to use. Keep the videos coming, thanks.
@RalphBacon
@RalphBacon 4 жыл бұрын
Sort of, Richard! You can power the ADS1115 from whatever source you like (ie the VCC pin) but the GND from that power source and your Arduino must be connected - known as a common ground. Glad you like my content, thank you for posting. Good question BTW!
@rtilt143
@rtilt143 4 жыл бұрын
The fact that you take the time to read and answer viewers questions speaks volumes.
@DavidLeeMenefee
@DavidLeeMenefee 7 жыл бұрын
Did you try to scope out the noise and solve this problem using hardware? Just asking...PEACE
@RalphBacon
@RalphBacon 7 жыл бұрын
As you might have gathered, ElectronicWizard, I became somewhat exasperated in trying to track down the noise, on the basis that if it *was* the PSU / USB then it would persist in a Real World implementation. If it was just picking up, I don't know, mains hum from the unshielded Dupont leads I used from the pot then we could address that. Whatever, I didn't use the scope but I might do if I dig this out again for a project. Good question, rambling answer, good to hear from you - peace indeed.
@DavidLeeMenefee
@DavidLeeMenefee 7 жыл бұрын
That would make for an interesting video...Thumbs up...just saying
@ElectricPaoloIAM
@ElectricPaoloIAM Жыл бұрын
Use the 1115 to measure A/R from 4 lambda sensors mounted in the down pipes of my monster.
@RalphBacon
@RalphBacon Жыл бұрын
Sounds good, Paolo, and I'm sure your monster also sounds good.
@MrVajutza
@MrVajutza 7 жыл бұрын
Ralph, maybe also consider rounding to the nearest 5, 10 or 25 etc on top of the running average. This would make it hold a steadier reading and make it nicer for a function to use it for instance 5,000 / 5 = 1,000 possible positions of the potentiometer or 500 if you round to the nearest 10. I have done this for a thermometer project in the past as 0 to 45 degrees Centigrade divided by 500 was sufficient. Cheers.
@RalphBacon
@RalphBacon 7 жыл бұрын
I like this idea, MrVajutza, whether in conjunction with the running averages or separately. Many suggestions are appearing here, thanks for that one. Good to hear from you.
@gavinsmalley1513
@gavinsmalley1513 7 жыл бұрын
I was just thinking the same thing. int stableValue = (noisyValue / 10) * 10; is a very useful line of code on the Arduino I have found. The noise is shifted off into the "lost remainder".
@skvalen
@skvalen 6 жыл бұрын
Be aware. If you connect ADDR to SCL or SDA you need to desolder the resistor to GND. Or things start acting weird.
@RalphBacon
@RalphBacon 6 жыл бұрын
Thanks for giving us all a useful heads up on this one, skvalen, I didn't try connecting ADDR to anything (left it at its default address) so good you told us. Thanks for posting.
@simonparker7773
@simonparker7773 2 жыл бұрын
My 1980s boiler does that sometimes it's the pot
@RalphBacon
@RalphBacon 2 жыл бұрын
You might be able to clean the pot with switch cleaning fluid - for goodness sake do not use WD40!
@bobbarnwell4756
@bobbarnwell4756 7 жыл бұрын
Nice video, Ralph. The variation from body capacitance might be present because I can't see pull-up resistors on the clock and data lines. I2C is used for remote monitoring, and seems like the leads ought not be sensitive to body capacitance in the short distance of this I2C pair.
@RalphBacon
@RalphBacon 7 жыл бұрын
Hey, Bob! It's not the I2C leads that are (particularly) sensitive to body capacitance, it's the analog input(s) that are possibly picking up the 100kHz - 1Mhz signal from them (I've had it happen before). And I'm pretty sure the ADS1115 has pull-up resistors on-board (which can be a problem if hanging multiple I2C devices on that bus, and they all have such resistors, it could drop so low that the Arduino can no longer raise the voltage sufficiently, but that's a different problem). Great post, Bob, thanks for dropping by (and I hope you're a regular).
@danieljquinn4293
@danieljquinn4293 7 жыл бұрын
Hello Ralph! Many thanks for all your videos: professionally recorded/edited, perfect sound and very heplful, thanks to your 'colloquial' and whitty (however clear and precise!) comments. I'm really intrigued by your little 'magic box' you use for switching your various displays (described in detail in video#28). What puzzles me is the 'other side', i.e.: how do you manage the switching of screens through the keyboard 'shortcuts'. You use a 'big' camera for your desk, a webcam for 'yourself' and one to capture the monitor and/or then...? Well done!! Regards to you and Benny from Valencia, Spain.
@RalphBacon
@RalphBacon 7 жыл бұрын
And then that's it, Daniel. There's no more to it. The OBS video recording software allows shortcut keys so it receives them and acts upon them. Easy peasy! Benny & I thank you for your greetings, nice to hear from a Spanish Arduinite!
@danieljquinn4293
@danieljquinn4293 7 жыл бұрын
Many thanks, Ralph. I'm back to electronics after a some 35 yrs...the last 18 dedicated to Calligraphy (!) Built my first DIY transistor radio 56 yrs ago, and my first Z80 computer in 1978. Now becoming an addict to Arduino (thanks to your super videos!)...
@RalphBacon
@RalphBacon 6 жыл бұрын
I mended my boss' ZX80 (could have been a ZX81, dim and distant memory now) and he was well pleased. That was back in 1982 or thereabouts. That was after I had built my first UK101 computer (en.wikipedia.org/wiki/Compukit_UK101 ) from a gazillion parts - I even went so far as to buy the RAM upgrade, from 4K to 8K. I then increased the (tape-based) storage speed to 600 baud (from the standard 300 baud, absolute snail's pace). Happy days. And yet here we all are, some 35+ years later with a computer called an Arduino that has more capability and is more fun than anything I ever used back then. Thanks for your kind words about my videos, you never know, I might have mastered the knack in another 100 videos or so!
@ashrafatteya
@ashrafatteya 5 жыл бұрын
connect other inputs to ground to reduce noise
@RalphBacon
@RalphBacon 5 жыл бұрын
Now that is a good idea, Ashraf, a bit like tieing unused op-amp inputs to ground etc to stop noise and oscillation that might indeed work well for the ADS1115. Next time I get this chip out I will try it. Thanks for posting.
@arunantony8786
@arunantony8786 6 жыл бұрын
I think an IIR Filter implementation would be much better. that way you could adjust the granularity easily.
@RalphBacon
@RalphBacon 6 жыл бұрын
Well now, Arun, infinite impulse response filters are a whole new ball game. That would require some experimentation, the time for which I don't have right now but I'll still make a note; who knows, one day maybe I'll have an hour and play around. Thanks for the suggestion.
@elsantisimok
@elsantisimok 5 жыл бұрын
Ralph, this video is great! Thanks for share your knowledge. I was wondering if you know any module DAC to be used with arduino. It would be very helpful if you can give me a hint. I hope you can do a video with this petition. Regards!
@RalphBacon
@RalphBacon 5 жыл бұрын
I've never used a DAC from an Arduino, Alfredo, but perhaps this link might give you some ideas: www.electroschematics.com/arduino-dac-guide/
@maranata693
@maranata693 Жыл бұрын
a great explanation! Thank you!
@RalphBacon
@RalphBacon Жыл бұрын
You are welcome!
@delugeia
@delugeia Жыл бұрын
easy way to do a running average... set the "average" to your first reading (to avoid the ramp-up). Then each time, take 90% of your average plus 10% of your new value... average = reading (setup) average = 0.90 * average + 0.10 reading (loop)
@RalphBacon
@RalphBacon Жыл бұрын
Yes, the "ramp up" may not be desired in a lot of cases. You resolution would resolve that. I like it. Fact is, I rather like it when I use my technique in my Smart phone charger controller; seeing the current rise over a few seconds is quite satisfying!
@ismzaxxon
@ismzaxxon Жыл бұрын
i am here because the esp8266 and even worse the esp32 A2D when using wifi. Issue with power on the silicon with those chips. Also esp32 is not a linear curve and limited to 1 volt. ADS115 solves the issue.
@RalphBacon
@RalphBacon Жыл бұрын
When using Wi-Fi some of the analog pins are not available, namely ADC2 pins (so GPIO 0-3, 12-14, 25-27). ADC1 is OK (so GPIO 32-39 although GPIO37-38 are not normally present anyway. Also GPIO 34-39 are input only [no pullups available, either] which may affect the sensors). It is not linear, correct. The first and last few values cannot be measured. So 3v2 and 3v3 will be the same (4095 when using 12-bits), as will be 0v - 0.1v. I'm glad we have the ADS115 although that suffers noise/jitter at high bit rates too!
@tablatronix
@tablatronix 7 жыл бұрын
Almost every video you do , is on a module or breakout I just received in the mail. bizarre.
@DrexProjects
@DrexProjects 7 жыл бұрын
He's Magic.
@RalphBacon
@RalphBacon 7 жыл бұрын
The Force is strong with me, Luke, er, sorry, Tablatronix! I guess we're all doing stuff with these Asian modules one way or another and we've crossed paths on a few occasions, I guess. But The Force is still strong with me (and Benny). Apologies to Obi-Wan Kenobi, should he be reading this (he has a keen interest in Arduinos I hear).
@LearnAgon
@LearnAgon 9 ай бұрын
Very nice! Excellent
@RalphBacon
@RalphBacon 9 ай бұрын
Thank you very much!
@LearnAgon
@LearnAgon 9 ай бұрын
@@RalphBaconone of the Agon Light 2 community members suggested your video as I am trying to understand this ADC for an Oscilloscope project on my microcomputer!
@frankji2410
@frankji2410 3 жыл бұрын
Tks. learn a lot from you
@RalphBacon
@RalphBacon 3 жыл бұрын
Glad to hear that!
@joeblow2109
@joeblow2109 7 жыл бұрын
Another great video....... do you have a patreon account? hope to see more on the buggy video. Cheers
@RalphBacon
@RalphBacon 7 жыл бұрын
I don't have a Patreon account, Joe. Perhaps if I reach the magic 10,000 subscriber mark then I will consider it. You're not the first person to ask so I will have to read up exactly what it is all about. Glad you like this video and yes, the buggy is moving along (albeit slowly - in all senses!)
@maxximumb
@maxximumb 7 жыл бұрын
Handy to know about.
@RalphBacon
@RalphBacon 7 жыл бұрын
Handy indeed, you never know when such a module might come in useful. Glad you're still visiting my channel Maxx, nice to hear from you.
@philowen2755
@philowen2755 7 жыл бұрын
Thank you.
@RalphBacon
@RalphBacon 7 жыл бұрын
Thanks for that, Phil Owen, nice to hear from you.
@erikderuiter7475
@erikderuiter7475 3 жыл бұрын
You make such *amazingly good* video's, thank you! But please note that fake chips like you use in this video will behave (slightly) different than genuine chips. Accuracy and fakes cannot go together. (although I don't say this is the only reason for the instability you show in this video) Also many chinese break-out boards are cheaper than the original chip alone. (digikey: $6,38 for 1 piece, bulk will be lower but not coming near the 1,26 of the complete alie board) go figure ;) I spent days researching fakes so I can confidently state all of the above. I made the same mistake, buying chinese fakes, resulting in strange behaviour of finished projects including faillure of the fake chips after months of use etc. So I learned my lesson.
@RalphBacon
@RalphBacon 3 жыл бұрын
Agreed. I've had fake nRF24L01 BT chips and some STM32F03 chips too that behaved very poorly.
#103 HC-SR04 Ultrasonic Obstacle Avoidance and Range Finder (fun!)
30:38
Tinkering with: ADS1115 analog-digital converter
18:30
pileofstuff
Рет қаралды 12 М.
Мясо вегана? 🧐 @Whatthefshow
01:01
История одного вокалиста
Рет қаралды 7 МЛН
Quilt Challenge, No Skills, Just Luck#Funnyfamily #Partygames #Funny
00:32
Family Games Media
Рет қаралды 55 МЛН
Правильный подход к детям
00:18
Beatrise
Рет қаралды 11 МЛН
Support each other🤝
00:31
ISSEI / いっせい
Рет қаралды 81 МЛН
AstroStation from ToupTek Astro. Will it be the ASIAIR Killer?
39:26
Star Walking (Wilfredo's Astrophotography)
Рет қаралды 517
Turn your Pico into a 400MHz 24 Channel Logic Analyser
25:26
Happy Little Diodes
Рет қаралды 67 М.
Read the analog world: Use ADC's on Pi Pico
13:56
Lutz
Рет қаралды 4,7 М.
Исследование сигма дельта АЦП ADS1220
20:31
Dmitry Kuznetsov
Рет қаралды 2 М.
I2C with Arduino and Raspberry Pi - Two Methods
30:13
DroneBot Workshop
Рет қаралды 208 М.
12-bit DAC Arduino MCP4725 How To Use It - Stable Voltage Reffrence
11:21
Мясо вегана? 🧐 @Whatthefshow
01:01
История одного вокалиста
Рет қаралды 7 МЛН