Arduino, ADS1115 16-Bit ADC with I2C Bus and Adafruit Library - The Details

  Рет қаралды 23,166

Robert's Smorgasbord

Robert's Smorgasbord

Күн бұрын

Пікірлер: 105
@joaoagricio4585
@joaoagricio4585 4 жыл бұрын
One of the most profound engineering channels i’ve found so far. Great videos.
@robertssmorgasbord
@robertssmorgasbord 4 жыл бұрын
Thank you very much for the praise :-)
@danman32
@danman32 Жыл бұрын
Excellent thorough yet easy to understand description of this chip and how the Adafruit handles it.
@robertssmorgasbord
@robertssmorgasbord Жыл бұрын
Thanks for the praise!
@peterbos3487
@peterbos3487 4 жыл бұрын
only 800 views, you are undiscovered diamond. great thorough video
@robertssmorgasbord
@robertssmorgasbord 4 жыл бұрын
Thanks for the praise! Anyway, 'cause I haven't monetized my channel, KZbin isn't too keen to suggest my videos. Therefore the channel isn't growing that fast; But that's OK with me for now. It's just a hobby, you know.
@seanpaxton
@seanpaxton Жыл бұрын
Another wonderful video Robert - many thanks indeed. Those 10k resistors on the Adafruit schematic are pull-ups. it is the SCL & SDA etc chip outputs that route to the connector. Thanks again and keep up the good work. Cheers
@robertssmorgasbord
@robertssmorgasbord Жыл бұрын
Hi Sean! Thanks again for the praise 🙂 Regarding the 10k resistors: Yeah, you are right, these are the I2C pullups. I totally misread the schematic there, it clearly said VDD on the other side of those resistors. My bad!
@danman32
@danman32 Жыл бұрын
FYI: a lot of the limitations of the Adafruit library were fixed. Current version of Adafruit_ADS1X15 now supports all mux modes. I am figuring out too that it seems the ADS1115 can only do one conversion at a time, since there's really only one AD converter in the chip., In that case, if I am understanding correctly, continuous mode can only work with one input (single or differential) mode at a time, particularly considering there's only one conversion result registry. Current version of Adafruit library also supports non-blocking conversions in single-shot. The library provides an example on how to accomplish this. Basically you use the startADCReading(uint16_t mux, bool continuous) function where mux specifies the input setting, continuous specifies if it is one-shot or continuous. Library contains defines that you can use for the mux input
@robertssmorgasbord
@robertssmorgasbord Жыл бұрын
Thanks for the info! It's good to see that Adafruit is maintaining their libraries. Maybe they got enough requests to add that kind of functionality and actually acted on that - kudos to Adafruit.
@danman32
@danman32 Жыл бұрын
Incidentally they have a built-in "count" to voltage converter function. Library already knows the gain you selected for the object instance, so it grabs that info internally, uses a case statement to apply the correct multiplier to the function input. Now if I can figure out if library supports enabling alert/rdy to tell me when a conversion is done. Not sure if chip really supports it well in single-shot anyway.
@robertssmorgasbord
@robertssmorgasbord Жыл бұрын
@@danman32 Again, thanks for the info! BTW: "In single-shot mode, the ALERT/RDY pin asserts low at the end of a conversion if the COMP_POL bit is set to 0." (chapter 9.3.8 in the datasheet). So yes, the ALERT/RDY pin is supported by the chip as ready signal in single shot mode.
@Sentinel-1
@Sentinel-1 3 жыл бұрын
Simply the best review about ADS1115 on KZbin. And my respect for reading the datasheet. I checked your other videos on the channel and now I realized, why this video is so good. One more good engineer in my sub-list. 😃👍 The only sad thing is that you use obsolete AVR MCU, but not modern and industry popular ARM Cortex-M MCU (like STM32). Even in the Arduino IDE/libraries they perform much-much better. And in this example with the external ADC on I2C bus, they provide NVIC and DMA to copy ADC values to MCU RAM mostly in the background, which is very economically in respect of CPU time.
@robertssmorgasbord
@robertssmorgasbord 3 жыл бұрын
Thanks for the praise! And thanks for subscribing! Regarding 32-bit MCUs (STM32 etc.): One day, when the 8-bit Arduinos are too slow for my purposes, I'll switch to a 32-bit MCU ;-) Actually, I might also do that if I ever need 64-bit floating point calculations. For now I'll just use up all those Arduinos in the drawer :-))
@andymouse
@andymouse 4 жыл бұрын
Marvelous ! that was, oddly enough just what I was looking for ! and filled a few gaps and answered a few questions, this is a great time to be playing with microcontrollers and I thank all the companies like Adafruit and people like you who take the time to help people like me...I wonder what's in the pipeline, you did buy a load of displays, were theses just replacing stock or have you another instrument in mind ?...whatever it is I look forward to it ...cheers !
@robertssmorgasbord
@robertssmorgasbord 4 жыл бұрын
I'm happy that video was helpful to you :-) The displays are for different projects where I'm burning away a few 100 watts of AC mains power anyway. So an additional few 100 milliamps at 5V to run those large 7-segment LED displays really doesn't matter. The first project will be my laboratory water bath for etching PCBs. I've already shot the first 3 1/2 videos ("The Hot and Wet Parts"), but the 3rd ended with an epic fail - BTW I'm over that by now ;-) The product of the first half of the 4th video is currently sitting behind my bench on the floor and curing. That is I'm letting silicon thermal adhesive holding parts together cure for at least two weeks. Not giving the adhesive enough time to cure was one of the reasons for the epic fail in the 3rd video ;-)
@rene-jeanmercier6517
@rene-jeanmercier6517 4 жыл бұрын
Hi Robert. Excellent as usual. These tutorial-like presentation are great knowledge and great reference material to come back to prior a design. They are like a small ebook on the virtual shelve of the designer. I like it very much. I don't know if you ever did a tutorial on DAC, but I would appreciate one on the double DAC from Microchip, the MCP4922, and reference voltage chips that are used to add precision to their output results. Thanks for all. Regards, RJM
@robertssmorgasbord
@robertssmorgasbord 4 жыл бұрын
Hello René-Jean, thanks for the praise! To be honest, I'm using these videos as ebooks myself ;-) You simply can't keep all the details in your head. And since my projects are going on for months at a time it's nice to be able to go back and see how I've done something when I actually need it in a project. Anyway, I'll put the MCP4922 on my wall of video ideas - as always no promises ;-) But a 12-bit dual channel DAC seems like a nice thing to have when working with Arduinos (never liked that PWM + RC-filtering thing). Best Regards, Robert
@rene-jeanmercier6517
@rene-jeanmercier6517 4 жыл бұрын
Thank you so much Robert ! Regards, RJM
@robertssmorgasbord
@robertssmorgasbord 4 жыл бұрын
Hello René-Jean, a few fellow up questions regarding a possible DAC tutorial ;-) 1. Does it have to be an MCP4922 (12 bit, 2 channels, external (!) reference, rail-to-rail output, SPI)? 2. Do you need exactly 12 bit, or can the DAC have a higher resolution (at approximately the same price)? 3. Do you need at least two channels? 4. Do you need the speed of SPI, or would I2C be sufficient? 5. Do you need a rail-to-rail output? 6. Do you need to be able to provide an external reference voltage? Best Regards, Robert
@rene-jeanmercier6517
@rene-jeanmercier6517 4 жыл бұрын
Hi Robert. Thank you for the consideration given to my suggestion. It could be a higher resolution DAC, but for good throuput I would prefer SPI transfer (I often use the STM32 Bluepill in my designs under PlatformIO / vsCode). It could be a single DAC but often it is nice to have two devices in one package ( to control two parameters like current and voltage). An external reference is good to select 2/4 volts (2.024 / 4.048) for different applications / environment. Thank you for all. Regards. RJM.
@robertssmorgasbord
@robertssmorgasbord 4 жыл бұрын
@@rene-jeanmercier6517 Hello René-Jean, I kinda find it hard to make a decision here. So I probably do a tutorial about the whole MCP49xx/MCP48xx familiy, specifically the MCP4821, MCP4822, MCP4921 and MCP4922 :-) Best Regards, Robert
@erikderuiter7475
@erikderuiter7475 3 жыл бұрын
Again you made a very useful video, subscribed! I gave this comment also on another ADS1115 video: 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.
@robertssmorgasbord
@robertssmorgasbord 3 жыл бұрын
You're very welcome! And thank you for subscribing! Regarding fake chips: I went through quite an experience in that regard with Chinese MAX31855K breakout boards. Faulty Chinese MAX31855K Modules: Fake Chips?!? (Edit: No! See Description!) kzbin.info/www/bejne/mHnLeIuof7N4q9k Faulty Chinese MAX31855K Modules: Fake Chips? No! Just a Capacitor Missing! kzbin.info/www/bejne/hqraeYmdf6aAq5o It turned out that the chips were OK, but the breakout boards were sh... (missing an essential capacitor). Back then I questioned the same thing you did: How can they sell these modules below the bulk price of the naked chips? My theory is that these chips are not really counterfeited chips, made in some clandestine chip factories. Instead I think these are chips, respectively, chips made from wavers that failed the quality tests, but were still "good enough". Most chip companies don't manufacture their chips themselves nowadays. It's all outsources to (mostly) Asian fabs. And manager of / people in these fabs might find it wasteful to through away sub-standard stuff that still kinda works. Instead these chips find their way to the Shenzhen market (or a similar place), where you can pick them up real cheap.
@erikderuiter7475
@erikderuiter7475 3 жыл бұрын
​@@robertssmorgasbord Thank you for your insight! But be aware that 'working' chips are not the same as reliable chips. I had lots of chinese parts failing in my projects after months of use. Troubleshooting is VERY difficult with dodgy chips. AND is can be DANGEROUS when for example building a DC-DC boost/buck converters! Fire hazard.. So I myself won't risk this, I rather pay more for safety. Also I see lots of video's about people putting a lot of effort in a project using "precision" compinents from china. Funny and sad at the same time. Some very interesting video's about this topic: - (!) kzbin.info/www/bejne/pWHVdq2ZgL6tfdk - kzbin.info/www/bejne/qX3NaGyHl9Gbp8U - kzbin.info/www/bejne/eGa2mJyobtJ8aaM - kzbin.info/www/bejne/oWiVhHl4hL-Sotk etc etc! Anyhow, keep up your great video's!
@robertssmorgasbord
@robertssmorgasbord 3 жыл бұрын
@@erikderuiter7475 You're welcome! And don't get me wrong, I neither think it's OK to sell sub-standard chips nor that it's a good idea to use them in real projects (both, the ADS1115 and the MAX31855 I was just using for tutorials). BTW all my AC/DC converters and safety relevant DC/DC converters I do buy from reputable sources only (DigiKey and German distributors) ;-) And thank you very much for the links - very informative!
@claudeviool3895
@claudeviool3895 3 жыл бұрын
Robert, in you code example you store e.g. 0.0000018125 in a float variable. If i'm not mistaking, in C a float is a single precision float i.e. 32 bit float. That has a precision of only 6 to 9 digits so you might loose a bit of accuracy. Using a double might be better there or else just store multiplier as mV instead of V.
@Sentinel-1
@Sentinel-1 3 жыл бұрын
You're absolutely right: float type has only 6 decimal digits of precision. If you need more then you need double type with 15 decimal digits precision. But it's a horrible idea for a slow AVR 8-bit MCU without FPU.
@robertssmorgasbord
@robertssmorgasbord 3 жыл бұрын
What Sky Sentinel said. You're absolutely right about the float's precision, but using 64 bit doubles on a 8-bit MCU is darn slow. Plus, doubles in the Arduino standard math library are also just 32 bit (exactly the same as floats). You'll need 3rd party libraries if you really need 64 bit doubles. Regarding using mV instead of V: A float stores the digits in some bits (23?) and the exponent in some other bits (8?): number = digits * 10^exponent (omitted the sign here). So just just moving the digits three decimals to the left (changing the exponent) doesn't really improve the precision.
@robertssmorgasbord
@robertssmorgasbord 3 жыл бұрын
The Arduino guys knew about that performance problem. So a double in the Arduino standard math library is also just 32 bit :-)
@Sentinel-1
@Sentinel-1 3 жыл бұрын
By the way if we're talking about small voltages (like current shunt voltage), it's a good practice to use mV instead of V, because of: 256/2^16 vs 0.256/2^16 = 0.003906[25] vs 0.000003[90625] = 25 pV vs 90'625 pV error. Anyway, the lowest useful resolution is just 10 uV, so it's not so important in this case. And using double type variables even on fast 32-bit Cortex-M MCUs with FPU (single precision!) still is not a good idea, it's better to shift a decimal point (you really don't need such precision in 99,9% of cases). MCU programmers are kings of the code optimization. 😄
@robertssmorgasbord
@robertssmorgasbord 3 жыл бұрын
@@Sentinel-1 You are right again, twice - about the good practice and that it doesn't matter in this application 😄 Regarding the double type variables: The FPUs of the STM32F76x/7x support double precision, but I couldn't find any benchmarks. For the rest (and other MCUs) I found a benchmark on KZbin ( kzbin.info/www/bejne/aWSao3ereKyYj9U ). Results for the STM32: single precision 196.5 VAX MIPS, double precision 70.62 VAX MIPS - not too shabby. But then, doubles take up twice as much space as floats, and we're still measuring the RAM of MCUs in KB not MB 😉 So keep on optimizing the code ...
@whitefields5595
@whitefields5595 4 жыл бұрын
Robert, thanks for this. I will use this tutorial measuring AC mains with current transformer
@robertssmorgasbord
@robertssmorgasbord 4 жыл бұрын
You're welcome! And sorry for the late reply - KZbin notifications for comments seem to get worse :-( Anyway, sounds your project is a perfect application for this relatively slow ADC. I'm assuming you're rectifying the output of the current transformer and then do some RC filtering. So you're filtering out anything above 50/60Hz anyway.
@whitefields5595
@whitefields5595 4 жыл бұрын
@@robertssmorgasbord Robert, I'm using op amps to either give a +ve and -ve peak detector or a fullwave rectifier with X 2 gain. Probably the latter as it all has to be +ve and full wave will double the frequency for easier smoothing. I want to do all the signal conditioning with passive components to spare the ADC hunting around. All too often we "do it in software" whereas a few std designs can make life easier! See rectifier here ..... kzbin.info/www/bejne/pGfYdKCFiNmCb8k
@robertssmorgasbord
@robertssmorgasbord 4 жыл бұрын
@@whitefields5595 I see, you're really going for a precision approach here. Kudos to you! And I totally agree with things done too often in software ;-)
@FinneyDale
@FinneyDale Жыл бұрын
Is the AD8210 also a good option for AC mains? Also Robert, I just found your channel while searching for the ads1115. Great video! i'm a subscriber now.
@whitefields5595
@whitefields5595 Жыл бұрын
@@FinneyDale Dale, I had trouble with ADC drift around the zero point. With 16 bits there was too much resolution and hence I got a lot of drift around the zero point. I could never get the ADC to stay at zero when measuring rectified AC mains voltages. I had great hopes, but I gave up in the end. I could not get it to hold steady even when I grounded the signal. . The breadboard is in my "One day I'll have another go' box!
@-Gadget-
@-Gadget- 4 жыл бұрын
One side note: The ADS1115 can NOT measure more than the selected voltage in the gain (Which ever gain you decide to use) , across All the inputs (Not individually). In other words, if you have 4 18650 batteries, and you do not include a voltage divider for the full 16,8v on all 4 of the ADS1115 inputs, you will have the serial monitor and equipment spitting out weird values. If you plan on using it to measure 4 separate voltages, with the accumulative value of your preset gain setting (4.096V or 6.144V), then you could potentially measure 4 x flat batteries etc without the need for the voltage divider. Examples of this are here: kzbin.info/www/bejne/r2mZdptsj5Z5mNU kzbin.info/www/bejne/aKnWcpSZabOcm5Y Anyway, I thought I would just share this with anyone watching, as this drove me nuts trying to figure out why every time the solar charge controllers were charging the batteries, the first bank showed the exact inverse of the second bank, and actually displayed the batteries draining while in fact they were charging, but because the gain voltage was maxed out, it then inverted the balance to show that excess voltage as a lower number. Infuriating to say the least. Texas Instruments obviously does not display this little nugget of information in their data sheet, which would have avoided many days of scratching a bald spot in my head! Ps. Thank you for the Very informative video on this item, and as much of a headache that this has been, I could NEVER use the built in analogue inputs of Arduino Ever Again, as the ADS1115's accuracy can just not be matched. The sheer lack of resolution calculated by the analogue input was enough to put me off for life. 10 bit analogue readings are for people that Don't know there are millivolts and microvolts after the decimal place........ 🤣
@robertssmorgasbord
@robertssmorgasbord 4 жыл бұрын
Thank you very much for the info! And yes, the ADCs of the ATmega chips are kinda crappy 😅 You've got to add at least a reasonable external voltage reference to use them beyond reading a potentiometer position as user input. The internal "voltage references" of the ATmega are less accurate than your average 5V supply rail 😁
@golddedektor
@golddedektor 3 жыл бұрын
I want to get advise about something from you. I am using Ads1115 16 bit module with Atmega 128 processor.. There is an incompatibility in the integrations on Ads1115.. For example, 07,92,97 ones run unstable, 84,95,93 runs more stable.. It distorts the signal sound more. What is the reason for this or how can we find a solution? How can we stabilize unstable types?
@robertssmorgasbord
@robertssmorgasbord 3 жыл бұрын
I'm sorry, but I'm at a loss here. What exactly are these numbers (07,92,97 vs 84,95,93)?
@simbiosy
@simbiosy 3 жыл бұрын
Hi Robert, i hope you are safe and well! I watched this video and it was very informative, thank you for this! I am doing a project on my on with a raspberry pi and i am having some problems to make the RPi read the i2c bus... During my throubleshooting i notice the outputs SDA and SCL of the ADS1115 are at 0V, is this right? I think the problems are with the ADS but i already bought 2 of them from different manufacturers (I am from Brazil and couldnt find the adafruit ones) and the results are the same... Could you offer some light to my problem? Thanks!! Keep up the great work :)
@robertssmorgasbord
@robertssmorgasbord 3 жыл бұрын
Hi Gustavo, thanks for asking, I'm doing fine. Hope you're doing well too. Before I answer a disclaimer: I never worked with a Raspi before. That said, the clock (SCL) and data (SDA) lines should always be high (usually 5V or 3.3V) when there's no activity on the bus. That's because of the pull-up resistors on both lines. As I understand it the SCL and SDA pins of the Raspi already have 1.8k pull-up resistors build in. So something is fundamentally wrong: A) The wiring between the Raspi and the ADS1115 is incorrect. B) The I2C interface on the Raspi is not properly activated (via software). C) Something is broken :-( I would suggest you check the wiring and general function by going with this Adafruit tutorial: learn.adafruit.com/adafruit-4-channel-adc-breakouts/python-circuitpython .
@robertonunez6626
@robertonunez6626 Жыл бұрын
How do I connect something to the adc tho? How would I connect an electric guitar if it only has one input?
@robertssmorgasbord
@robertssmorgasbord Жыл бұрын
Well, I have no idea about the electrical specifications of electric guitar pick-ups, so I can't really answer your question. But what do you mean by "if it only has one input?"? The ADS1115 has four single ended inputs, which can be used as two differential inputs. That should be more than enough for one guitar. Or does each string has it's own pick-up and signal?
@Industrieelektriker
@Industrieelektriker 3 жыл бұрын
Hello Mr. Robert, please can you show me how can i measure Voltage. I have one Source +-12V and a 10kOhm Potentiometer. I would like to measure and display this Voltage Range ( +12V 0V -12V) on a Display.
@robertssmorgasbord
@robertssmorgasbord 3 жыл бұрын
Well, you just have to get your voltage into the range the ADS1115 can actually measure. The simplest way would be a passive voltage adder (2 precision resistors). One input goes to your +/-12V, the other to a fixed positive voltage to lift your -12V up to 0V (from a voltage reference) and your output goes, well, to the ADS1115. See www.allaboutcircuits.com/textbook/semiconductors/chpt-8/averager-summer-circuits/ BTW your not by any chance Dr. Z testing the waters?
@Industrieelektriker
@Industrieelektriker 3 жыл бұрын
@@robertssmorgasbord Thank you for the Answer. Sorry for my bad English, i dont understand the term "BTW your not by any chance Dr. Z testing the waters?" what it means. Regards from Bavaria (Oktoberfest) ;-)
@robertssmorgasbord
@robertssmorgasbord 3 жыл бұрын
@@Industrieelektriker Ah, forget about that. I thought you are somebody else that I knew a long time ago (Dr. Z., first/middle name K./P.).
@electronic7979
@electronic7979 4 жыл бұрын
Helpful video. I liked it
@robertssmorgasbord
@robertssmorgasbord 4 жыл бұрын
You're welcome :-) And thanks!
@SagarYadav-qv8mo
@SagarYadav-qv8mo Жыл бұрын
It's very informative, thank you
@robertssmorgasbord
@robertssmorgasbord Жыл бұрын
You're welcome :-)
@fabian327
@fabian327 4 жыл бұрын
I'm really new to this so I don't know when I'm doing something stupid. I'm currently measuring a Voltage of an induction Coil that only produces about -10 mV to 10 mV (as long as I don't accidently touch it) and my ADS1115 seems to measure it fine. Am I damaging my ADS or is this okay?
@robertssmorgasbord
@robertssmorgasbord 4 жыл бұрын
As long as you keep the analog input voltage above GND-0.3V and below VDD+0.3V (datasheet absolute maximum ratings) your ADS1115 will survive :-) If you're worried about your coil producing voltage spikes beyond that you could clamp the analog input voltage to your ADC by using anti-parallel diodes (e.g. www.mwrf.com/technologies/passive-components/article/21846045/limiters-protect-adcs-without-adding-harmonics ) or go all the way and use some Schottky diodes (e.g. www.analog.com/en/technical-articles/protecting-adc-inputs.html ).
@fabian327
@fabian327 4 жыл бұрын
@@robertssmorgasbord Thank you very much :). Im relieved to hear that. Because I already spent a lot of time on my project I will just hook it up without protection at the moment but in the future i will study the page you provided (I already read most of it but didn't understand enough to feel confident) and try to implement it.
@robertssmorgasbord
@robertssmorgasbord 4 жыл бұрын
@@fabian327 You're welcome! Maybe I'll make a video about input protection at one point - no promises though.
@caominhang8077
@caominhang8077 2 жыл бұрын
I have a question, if I set gain sixteen and put 1V into A0 pin, then will it destroy the module or not. If not, will I obtain the maximum value of analogRead when refer to A0 pin ?
@robertssmorgasbord
@robertssmorgasbord 2 жыл бұрын
It will not destroy the chip. The absolute maximum rating for the analog inputs is VCC+0.3V according to the datasheet (independent of the gain setting). As long as you stay at VCC or below everything is fine. The only thing that happens is that the programmable gain amplifier is overdriven and will try to create 16 x 1V = 16V, which of course it can't, because its output is capped by VCC. So yes, as you expected you will just obtain the maximum value.
@caominhang8077
@caominhang8077 2 жыл бұрын
@@robertssmorgasbord thank you so much
@robertssmorgasbord
@robertssmorgasbord 2 жыл бұрын
@@caominhang8077 You're welcome!
@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 !
@robertssmorgasbord
@robertssmorgasbord 4 жыл бұрын
Hi, of course you could. I think there's even a Arduino Joystick library for the Pro Micro. Though you might have to modify it to use the ADS1115. Tom Stanton has done something similar: kzbin.info/www/bejne/iZjUl5-ZfaeHrcU (DIY Flight Simulator Joystick). I liked the use of the hall effect sensors in his project.
@FlySweden
@FlySweden 4 жыл бұрын
Thank you for the answer. I would like to build the exact same yoke as Tom Stanton but with a better resolution than 10 bit. That's why I am asking about the ADS1115 !
@robertssmorgasbord
@robertssmorgasbord 4 жыл бұрын
@@FlySweden You're welcome! Using the ADS1115 instead of the (crappy) internal ADC of the Arduino is definitely an improvement. Good luck with your project!
@BeetleJuice1980
@BeetleJuice1980 3 жыл бұрын
I get two digits after the dot in differential mode, why?can we ask how many digits we want? It's the number 10 you used in the ads function? Great review!
@robertssmorgasbord
@robertssmorgasbord 3 жыл бұрын
I guess you're talking about the "Serial.println( adx..., 10 );" statements. The 10 is indeed the number of digits printed after the decimal point. If you just use "Serial.println( adx... );" without specifying the number of decimals you want, you get 2 decimals by default, e.g. "1.23". And thanks for the praise!
@BeetleJuice1980
@BeetleJuice1980 3 жыл бұрын
@@robertssmorgasbord couldnt find anything in the pdf from the ads1115, only in your video I found it. did I miss something in the pdf? thanks for the reply!
@robertssmorgasbord
@robertssmorgasbord 3 жыл бұрын
@@BeetleJuice1980 No, you didn't miss anything. This two (or more) digits thing happens purely on the Arduino side and has nothing to to with the ADS1115. So you'll find absolutely nothing about it in the datasheet ;-) Have a look at the Arduino Serial.print function instead: www.arduino.cc/reference/en/language/functions/communication/serial/print/
@markj3851
@markj3851 4 жыл бұрын
Great video Robert. Would you think the ADS1115 ok to measure the -75mv to +75mv swing of a typical current shunt resistor safely using the Gain16 and differential mode? Would the anti-parallel diodes be useful here as well?
@robertssmorgasbord
@robertssmorgasbord 4 жыл бұрын
Yes, you could use two inputs of the ADS1115 in differential mode to measure a +/-75mV voltage across a shunt resistor (though the smallest input range is +/-256mV, so you have only about 1/3 of the dynamic range available). However, note that the absolute minimum input voltage of each input is the ADS1115 GND - 0.3V and the absolute maximum input voltage of each input is the ADS1115 VDD + 0.3V. That is both ends of your current shunt must always be within that voltage range or you destroy the chip! The build in anti-parallel diodes will (hopefully) do nothing for you (they just implement some rudimentary input protection).
@markj3851
@markj3851 4 жыл бұрын
@@robertssmorgasbord Any simple suggestions to provide some protection to the inputs to keep things from swinging below the -300mv range without effecting the signal?
@robertssmorgasbord
@robertssmorgasbord 4 жыл бұрын
@@markj3851 That's a very good question! Here's a rough idea: You need of course a resistor in series to the input pin. Then, you take a diode, with the cathode connected to the input pin too, and the anode connected to a +300mV rail. If the input voltage falls below -300mV the diode will start to conduct (total voltage across the diode +300mV - -300mV = 600mV) and keep the input pin at -300mV. The resistor should of course be much smaller than the input impedance of the ADC. Common mode input impedance in the 0.256V Range is fortunately very high (100MOhm). So if you take a 10kOhm resistor the diode needs to supply 0.1mA per 1V "undervoltage". The +300mV rail can be created by two resistors forming a voltage divider between your supply voltage and ground. For 10V "undervoltage" you need 1mA through the diode. So a cross current of 10mA through the voltage divider should be enough. Of course I have no idea what "undervoltages" you're expecting, so you'll have to do the resistor dimensioning yourself ;-) But there you have it: 1 diode and three resistors - simple enough?
@markj3851
@markj3851 4 жыл бұрын
@@robertssmorgasbord Great example Robert- Thank you. I found some info on a "diode limiter with adjustable bias voltage" which sounds very similar. I tested it on a breadboard and it seems to work well. There isn't a sharp cutoff when the diode starts to conduct so the voltage still creeps up slowly, but it's a simple and effective solution.
@robertssmorgasbord
@robertssmorgasbord 4 жыл бұрын
@@markj3851 I really didn't know that my idea is a valid and common technique :-) But obviously it is: www.theengineeringknowledge.com/wp-content/uploads/2020/01/Diode-limiters-implemented-with-voltage-divider-bias.jpg The whole article is here: www.theengineeringknowledge.com/diode-limiters-circuits/ Anyway, saves me from making another tutorial video - or maybe not ;-)
@strielokholmes4254
@strielokholmes4254 3 жыл бұрын
Hi. Just found out your channel. It is just amazing. Hope it goes well and more people will find it too :) Great job and keep it up. I am new to this and got one question. If I have inputs from a sensor +/- 2V max and wanting to use the differential inputs, can I set A1 to GND and A0 to the output from the sensor or need to offset it by 2V and set A1 to 2V so both are positive and the difference is the actual value? Additionally, if I use 860 SPS for that range of values (with gain set 2 so the max is +/- 2.048), is it worth using an antialiasing filter with corner frequency set to around 350 or 400 Hz? Afaik, it should be a bit less than half of the sampling frequency. Will measure breating pressure so there is no need of huge frequencies if it gives any background. Any help with these two topics will be really appreciated.
@robertssmorgasbord
@robertssmorgasbord 3 жыл бұрын
Thanks for the praise! To answer your first question: You'll need to offset the inputs from your sensor! The (absolute) input voltages on any input should be between 0V (GND) and your set reference voltage / max input voltage for your set gain. The easiest way to accomplish that is by using an resistor voltage adder (just add 2V to your sensor outputs): www.daycounter.com/Calculators/Voltage-Summer/Voltage-Summer-Calculator.phtml Of course there are more precise solutions using OpAmps ... Regarding your second question: To see if it's worth to use an antialiasing filter I would first have a look at the raw digitized signal. If the signal is good enough without the filter you won't need one ;-) It's hard to predict with sensors and ADCs if you'll need a filter or not. Anyway, if we're talking about adult human breathing I guess a corner frequency of 5Hz is more than high enough. The 350Hz to 400Hz would be more along the line of filtering out bit-noise from the ADC, yes?
@strielokholmes4254
@strielokholmes4254 3 жыл бұрын
@@robertssmorgasbord Great! Thank you for your quick and incredibly helpful response. Really appreciate it :)
@robertssmorgasbord
@robertssmorgasbord 3 жыл бұрын
@@strielokholmes4254 You're welcome!
@CoolDude-vc2fl
@CoolDude-vc2fl 4 жыл бұрын
3:00 are Ferrite beads not poly fuse.
@robertssmorgasbord
@robertssmorgasbord 4 жыл бұрын
Thanks! Ferrite beads (FB), of course! Two of them filtering GND and VDD makes total sense. I was to lazy to look those parts up - my bad. So here it is: MMZ2012Y152B: 1500 Ohms@100MHz, 0.4 Ohm DC, 500mA max.
@МельникАлександр-р1т
@МельникАлександр-р1т 3 жыл бұрын
Using 3 pcs of ADS1015 modules in one project. Good day! How can I use Adafruit_ADS1X15.h to enable modules ADS1015 with addresses 0x49 0x48 and 0x4A? How can I set the address in Adafruit_ADS1X15.h for each module ? I have already set the necessary addresses with a jumper on each module . Many thanks, have a nice day!
@robertssmorgasbord
@robertssmorgasbord 3 жыл бұрын
See 27:37 ("Using different I2C addresses" in the video description)
@futuriones
@futuriones 8 ай бұрын
@@robertssmorgasbord It seems that the current version of the library does not support changing the address. When trying to set the address in the code "Adafruit_ADS1115 ads(0x49);" or other, the program returns the error: no matching function for call to Adafruit_ADS1115::Adafruit_ADS1115(int)'. Rather, they have changed the way they specify the address. Now the address is set in the setup() section by the function "ads.begin(0x49);"
@robertssmorgasbord
@robertssmorgasbord 8 ай бұрын
@@futuriones Thanks for the info! Most Arduino libraries (not mine though) tend to set the address with the begin() method. I guess Adafruit updated their library to comply with that "convention". I personally tend to pack every hardware related parameter (e.g. addresses, pins) into the constructor, because they really cannot change during runtime.
@hoomansarvghaddi6366
@hoomansarvghaddi6366 3 жыл бұрын
it's not a 16 bit adc it's a 15 bit adc. I don't need sign bit. how could I use 16 bits? get value from 0 ~ 65535
@robertssmorgasbord
@robertssmorgasbord 3 жыл бұрын
Nope, it's 16 bit DAC. Remember, you can use it with differential inputs. And so you can actually get negative values / need the sign bit. If you just want to measure between for example 0V to 4.096V you can connect one pin of a differential input to 2.048V to get the whole dynamic range of 16bit.
@pijusgrigaliunas2526
@pijusgrigaliunas2526 3 жыл бұрын
​@@robertssmorgasbordBut how schematically should this look? If I only have two pin 0V to 4.096V, how to get that input of 2.048V?
@robertssmorgasbord
@robertssmorgasbord 3 жыл бұрын
@@pijusgrigaliunas2526 You'll need some extra circuitry. In this case a voltage reference. Fortunately there are 2.048V voltage references available. So you can feed the output from that voltage reference directly into an input of the ADS1115. Or ... you can use another ADC without differential inputs and avoid that problem altogether.
@carrocesta
@carrocesta 2 жыл бұрын
very nice viedo dude!
@robertssmorgasbord
@robertssmorgasbord 2 жыл бұрын
Thanks for the praise! And you're very welcome!
@filitrekahve2428
@filitrekahve2428 6 ай бұрын
Thx
@robertssmorgasbord
@robertssmorgasbord 6 ай бұрын
You're welcome!
Tinkering with: ADS1115 analog-digital converter
18:30
pileofstuff
Рет қаралды 12 М.
Quando A Diferença De Altura É Muito Grande 😲😂
00:12
Mari Maria
Рет қаралды 19 МЛН
How to Fight a Gross Man 😡
00:19
Alan Chikin Chow
Рет қаралды 20 МЛН
ADS1115 16 Bit ADC Module with Arduino
12:08
Gadget Reboot
Рет қаралды 53 М.
Solving I2C Address Conflicts - TCA9548A I2C Multiplexer
24:29
DroneBot Workshop
Рет қаралды 106 М.
ADS1115: Using HI/LO Threshold limits
15:53
ESRepair
Рет қаралды 806
ADC noise measurement, methods and parameters
25:35
Texas Instruments
Рет қаралды 4,6 М.
3 engineers race to design a PCB in 2 hours | Design Battle
11:50
Predictable Designs
Рет қаралды 452 М.
ADS1115 16 bit ADC with PGA test and measurement
23:06
Billy Martin
Рет қаралды 20 М.