today's tinkering is accompanied by get up off of that thang a soulful brown ale by devil may care
brewing in winnipeg i've had this one a couple of times and i do really like it even though
it's not as heavy and dark as a stout reporter it is a really good beer so today i'm going to
be tinkering with these ads 1115 modules that i got in the last mailbag these uh for those of
you who were there at the time or have seen that video these are a four port for input analog to
digital converter on the module we have power and ground as you'd expect seo and sda so it speaks i
squared c it has an address input an alert input which is optional and then the four analog inputs
this seems to be a really useful little board so i think today would be an excellent time
to spend a little bit of time playing with it and just seeing some of the use i can put it to
but in order to make use of it i'm going to have to solder it up and i'm going to need a
micro controller to work with it so i'll have to i think i'm going to choose a microcontroller that
doesn't have very many analog inputs which would be any of the esp8266 or
esp family of microcontrollers but for this i think i will use a d1 mini oh there's one
that's already got pins on it so a little bit less soldering that i'll have to do
cool so i'll just quickly solder this guy up so that i can use it and we'll come back in a minute
all righty then here we have it on a breadboard i've wired the i squared c seo and sda
up through a level shifter just a standard level shifter board they're cheap and plentiful
that way i can run this guy off 5 volts rather than the 3.3 volts that the d1 speaks so i can
get a little bit wider usage of this thing measure a little bit wider set of voltages
so i guess the first thing to do would probably be to find out what the i squared c address of
this thing is and to do that we will use just the standard i squared c detect sketch what it does
is just quickly scan through all the possible i squared c addresses that exist and reports back on
what responds on the bus in this case that address is 4 8 not 48 because this is hexadecimal so it's
4 8. but if you remember there was an address pin on that module so i think we should at least have
access to a few other addresses so let's just take that address pin low and see what happens
no change so low must be its default state okay
in that case let's take it to five volts and see what happens
ah four nine okay so we got a couple addresses to play with
that means we can have even more analog inputs on our microcontroller excellent however
looking at the data sheet it tells me that there is actually four possible addresses so if i take
that address pin to sda or scl i should get a couple more addresses okay so let's try that
uh where is sda is there oh we got four a okay how about if we try scl come on get in there 4b okay
so there is our four possible addresses so if we can address four of these things and there's four
analog inputs each we've got 16 analog inputs we can play with
since i've got the data sheet up how about i actually look at it a little bit here just so we
know what we're dealing with rather than diving in all half cocked which is you know my normal mode
so the supply voltage can be anywhere from two volts to five and a half volts it can have either
four analog inputs or two differential inputs so measuring the difference between two voltages
simplify block diagrams so there looks like there's a whole family of these uh similar
ones but this particular one the 1115 has 16 bit resolution and it has the most input pins
at that high resolution there's the recommended operating voltages again the
supply between two and five and a half volts full scale input uh up to six point one
four volts oh okay so it can actually measure voltages higher than vcc which i assume means
that it's voltage dividing stuff down inside it that just makes sense operating temperature from
ridiculous to ridiculous high impedance inputs yeah okay data rates up to 860 samples per second
i don't know what else do we really need to know here so it looks like
it takes the four inputs one at a time and switches them through the pga which in this case
has nothing to do with pro golfers and it is not as i initially thought a programmable gate array
it is a programmable gain array then it just goes into the 16-bit analytic digital converter
and then out over the i squared c interface i think that's about all we need to know for
what we're doing here right now this is all fancy timing stuff if i was writing a library
this might be useful but i'm not writing a library i am using existing libraries
and it appears that there are several libraries to choose from you may notice i've got a couple
of them already installed that i'm playing with so let's start with the actually there's one
more that doesn't show up on this page which is the adafruit one so let's start there because
that's a convenient place that a lot of people are gonna start there's a few things in the
examples that come with the adafruit library that you can configure you can choose if you
want to use the 16-bit version or the 12-bit version obviously i'm using the 16-bit version
and what else you can set the gain i'm just going to leave it a default for now other than that
it just goes through does reads and computes the voltages and then displays them like that
so i don't have any voltages connected right now for it to measure so let's go and do that
let's just put one of them uh how about a0 over to
i don't know how about the five volt input for now i'll plug a few i'll plug these batteries in
as well why is that battery got two magnets on it i love these little spherical magnets
by the way they are just so handy for doing that with let's put that lithium ion on to a1
let's connect up this double a battery to something about the third input sure and let's
just put an arbitrary voltage onto the fourth input that we can change with this thing here
connect to ground what's it set for right now it's set for four volts okay now let's go and
see what's happening well there we go we've got some different voltages to look like look at
so let's just stop scrolling for a minute here because these aren't changing
there are five volts in the first input and that i think is the raw measurement
that it calculates out into an actual voltage that is my half discharged lithium ion battery
that is my double a and that is four volts coming from the power supply the library doesn't seem to
have a lot of uh fancy stuff going on but one thing i do notice is it doesn't do anything to
address the uh the addressing it just uses the default address which is what was it uh four
eight um but nowhere in this demo sketch or any of the adafruit demo sketches it doesn't say anything
about that so i'm gonna move on to a different library because i have many to choose from
so here's another one that's uh fairly well rated in the listing
this one calls itself the white rabbit driver and this is just the demo that
comes with it or one of the demos again just like every arduino library there's one or more
demos that comes with it that shows off its capabilities and this one allows you to state
the i squared c address by saying you've either got it grounded or sent to vdd or to sda or scl
so you don't even have to know the numbers of them it just just deals with in that way so this
one currently is set to ground let's let's set it to use a different one just because
let's go with s c l and i will upload that and then we'll try it to
just to prove that i squared c addressing works duh we kind of already know that but
why not okay so when we bring that up we notice it's uh just got the 16 bit to input maxed out
65535 a nice familiar number with it for anybody who's ever looked at binary counting in the past
and of course it's showing that because we haven't set the address line yet so if i connect the
address line to scl there and hit the reset there we see that the values have all changed but this
thing again is showing raw numbers and i couldn't find anything in this library's documentation
about how to calculate that into actual voltages it's just the raw value coming out of the thing
if you needed that that would be a fine library to use but i'm not going to use it i'm going to
use a different one this library is called the ads115 underscore w e library i have no idea
what that stands for um this one also deals with the addressing and it just does it in straight up
numbers which is fine we already know what those are in this example sketch has an awful lot of
different options in it all fairly well documented right inside the example sketch which is
quite nice and shows what the defaults are and everything else
this particular one is set up as continuous mode there are a few other modes but again
for most of us i think continuous mode would probably be the one you want anyway here's what
its output looks like again it's doing it in volts so we got five volts on the first one which is
five volts coming off the usb 2.15 which is my horribly discharged uh lithium ion
battery 1.23 which is a double a and four volts is what's coming off my power supply and actually
let's vary that yeah i'm varying my power supply and you can see that it's tracking very well
now this thing says it can it can measure above the five volts so let's see that yes it can
there is six volts on the power supply but 5.57 seems to be the highest that it can do so just for
fun i thought i'd try it on a different processor just to see how well does the libraries load this
d1 mini is an esp8266 this is an esp32 on this olympics uh board that where'd i get this thing
from oh another maker sent this to me a while ago so i will just quickly swap the wires over
i'm not going to bother removing that d1 mini right now i'll just reconnect everything and i'll
get it right back to you here and there we go i just threw the adafruit library
back onto that guy and lo and behold it is showing exactly what we expected to say
and it looks like the five volts coming out of that ole mx board is a little bit lower
is that correct yes it is 4.8 volts is coming out of that not 5 volts okay
so it is correct cool and i mean there's no reason why that shouldn't have worked right except for
libraries sometimes are a little a little finicky but the adafruit library is fine with this esp32
and again any of the esp chips only have one built-in analog input available so this just
seems like an excellent way around that uh limitation should you need lots of analog
inputs so i guess the next thing to try is using two of these together so connected up for voltages
i've got this potentiometer here between ground and five volts that's going to the first one
the second input i've got coming from the 3.3 volts and the third one i don't have connected
anything in the fourth one i've got connected to this old samsung phone battery which well let's
just see if it'll tell us what the voltage is so i've slightly modified the sketch to address the
second one i'll take a look at that in a second but i just want to look at that let's stop it from
scrolling for a second so the first four are the same the five volt bus the lithium ion the double
a battery and the uh where is that coming from oh yeah that's coming from the external power supply
then this one number five is the first input on the second board which is the potentiometer
uh there's a 3.3 volts that's nothing and this is that samsung phone battery let me start that
scrolling again and i'll adjust the potentiometer so you should see number five changing here
as i do that there we go
so that is working how i had expected it to most excellent
and here's the sketch behind it it is exactly the same as the previous we library continuous
sketch that was the demo except for i just made it a multiple so i just
duplicated a bunch of things in here i created a second address created a second instance
and then just doubled everything up down here set the com the comparator channel
uh what else was i using here the measurement mode is continuous as opposed to single shot i doubled
up on the read channel and then doubled up on all of the printouts very straightforward i like this
library it seems to be for my level of coding anyway the most user friendly the most versatile
i'm sure people who are more advanced that coding will find some of the other libraries handy and
cool there is a bunch of libraries to use for this thing
so i could go through and wire up the rest of them but this kind of proves it to me and demonstrates
it to you and that's kind of the point of these tinkering videos is mostly for me just to try the
different modes that uh that these things work in and see if they will work with the various
things that i've got going on around here and that i might want to do there are a bunch of other
modes that these things can do we saw it in the library examples we saw it in the data sheet but
if i decide that i need to use those then i will definitely uh explore those in the future but for
now this is the mode that i am most likely to use this thing in if i want a whole bunch of inputs
and yeah the uno and the nano and some of the other boards do have a bunch of analog inputs
the uno has six of them and the nano i think has does it have eight it is yeah it has eight analog
inputs but they both speak i squared c so you can add 16 more to them using these little boards
and i think that is going to come in handy in the future some of you may remember this monstrosity
which is working towards a diy dmx project for controlling lighting and the uh the setup that
i've got on it right now uses to i think it uses all of the analog inputs available on that nano
so i could go much bigger if i chose to of course i'll have to get more potentiometers but that's
minor i'm not sure if that's what's going to happen but i'm still waiting for other parts
for this thing so that can be back on the sidelines for a while and in the meantime
i think that'll do it for today um if you've played with these things uh let me know what
uh what applications you found for them i think i noticed in the mailbag comments a few different
people were saying that they had used them in the past yeah i think it is a very versatile little
thing and if i can find more of them for the really good price i got them for in the mailbag
which isn't the price that they are currently but you know um i think i will make use of
them several times in multiple different things anyway that's enough of me rambling um thanks
for watching everybody questions and comments down below as usual i'll talk to you later