hi all,
currently working on a project and have filled up all 8 addresses on I2C, but need few more. any relatively simple way to multiplex more somehow without comple rewite of the code?
many thanks,
alek
hi all,
currently working on a project and have filled up all 8 addresses on I2C, but need few more. any relatively simple way to multiplex more somehow without comple rewite of the code?
many thanks,
alek
I2C supports 128 devices.
Unfortunately, many of the devices only have a few address lines that can be changed.
thanks westfw, i am using adafruit 7seg displays that can be hard-wired for 8 different addresses.
anyone used one of these:
I do not need to add like 20 more devices, but perhaps 3-4 more 7seg displays, all displays already have 50 milliseconds delay so not sure if i would slow things down by adding I2C multiplexer...
Thanks,
Alek
One way is to wire a separate output pin to one of the address-setting pins on each device. Set the other two address-setting pins on every board the same. Now you can switch each device from the inactive address to the active address and talk to it.
johnwasser, thanks, but i am not sure i understand what you mean and how should that work...
many thanks,
alek
Not sure how to make it clearer!
On each of your display boards, you have three jumpers to select your one-of-eight addresses for that board.
Well, you can change the address "on the fly" by controlling one (or more) of those address pins with an Arduino output pin - an extra wire. So set the first two address pins (A0, A1) on four of your boards to four different combinations. Connect the other address pin (A2) to an Arduino output pin. Do the same for another group of four boards and the same for the third group of four.
You now have three Arduino pins controlling the high address pins for each of three groups of four. If you set two of the "select" pins LOW and one HIGH, then when you send I2C commands to a display with the A2 address bit as a "1" it will address one of the displays (depending on the lower two bits) whose A2 bit you set high but not one of the other two groups. By choosing to which group you set A2 HIGH, you choose the display from only one of the three groups of four, given that you only ever use I2C addresses for the displays, which have the A2 bit of the I2C address set to "1".
This is clearly extensible to however many displays that you wish, given that each group of four requires its own "select" line, though if you wanted many more, you would use a decoder of some sort (such as a 74HC017 - one of ten) to choose the "select" line with a minimum of additional Arduino pins. A 4017 would allow you to connect 40 displays with only two Arduino pins other than the I2C pins.
The HT16K33 chip (as used in the Adafruit LED Backpack) can drive 16 digits on each of eight I2C addresses. Did you need more than 128 digits?
Paul__B:
On each of your display boards, you have three jumpers to select your one-of-eight addresses for that board.Well, you can change the address "on the fly" by controlling one (or more) of those address pins with an Arduino output pin - an extra wire.
Sadly, the HT16K33 chip doesn't use simple inputs for selecting the I2C address. It uses three entries in the keyboard/LED scanning matrix. It would not be easy to control any of those bits with an Arduino pin.
Thanks guys!
No, i would need 40 digits as absolute maximum. Now i have 7 displays active and one I2C address is taken by BME sensor, if i could add 2-3 more 4 digit displays, that would be awesome!
johnwasser:
The HT16K33 chip (as used in the Adafruit LED Backpack) can drive 16 digits on each of eight I2C addresses. Did you need more than 128 digits?
Would this mean that i can connect 2 displays with the same address and treat it as one? I can select character on each display by using the code like this
display2.writeDigitNum(0, tensofseconds);
Basically addressing the character where to output "tensofseconds", on the first character 0.
on Adafruit homepage this goes from 0 to 4... would be great if i could use two displays with the same address and just address the characters from 0 to 8... like with MAX7219
Is this what you meant?
Many thanks,
Alek
elcrni:
Would this mean that i can connect 2 displays with the same address and treat it as one?
No. You can't put two 4-digit displays at the same I2C address and treat it as a single 8-digit display. What I was getting at is that to drive 40 digits you could use five 8-digit displays or three 16-digit displays. Since 5 and 3 are lower than 8 you would not be running out of I2C addresses.
elcrni:
Now i have 7 displays active and one I2C address is taken by BME sensor,
Is the BME sensor address in the same 0x70 to 0x77 range as the displays? If not, it would not conflict with an 8th display.
Is the BME sensor address in the same 0x70 to 0x77 range as the displays? If not, it would not conflict with an 8th display.
Sadly, its 0x76, it does have SPI pins as well but i cant make it to work...
many thanks,
Alek
I missed your board. assume it is an UNO ?
some spare digital pins ?
have you tried softI2C ? or one of the other libraries that uses digital pins as a second I2C port ?
playground SoftI2C
I am using MEGA board. Havent tried soft I2C, sounds interesting though.
Now, i was playing around with MAX7219 7 seg displays, desoldered one display from the board (red, digit size 10mm) rated at max 5.5V... connected 0.56" displays in its place (yellow, as i need) and everything works great, so i may go that road. The only problem i have now is, i have 2 MAX7219 board, first one is very bright but the second one gets only 3.5V from the first board and the display on the second board is very dim... any ideas on how do i get 5V output from the first board in daisy chain to the second one?
many thanks,
Alek
elcrni:
The only problem i have now is, i have 2 MAX7219 board, first one is very bright but the second one gets only 3.5V from the first board and the display on the second board is very dim... any ideas on how do i get 5V output from the first board in daisy chain to the second one?
Aha!
You are using these:
See that diode "D1" on the board? It is a well-meaning addition to protect from reverse polarity but actually a design mistake. Remove it and bridge with solder.
My previous explanation regarding displays with PCF8574 port expanders was of course correct; I gather you are still having difficulty with it!
Yep, that was the one that made the problem, all good now, thanks! As for PCF8574 port expanders, at this moment i think MAX7219 road is easier and less complicating. I may even go and try HT16K33 but in both cases, hate multiplexing after trying ready made I2C solutions
Also strange is that it is impossible to find ready made MAX boards...
many thanks for all the help and suggestions guys!
Alek
Well, chaining those MAX7219 modules means you can operate at least 12 from just 3 pins but it may be as well to run an additional power (with ground, that is) cable to "tap" in every four or so boards. And you may find it getting a bit dodgy with so many latch and clock lines in parallel with a lot of cabling length, so you may have to slow down and use software shifting rather than SPI.
And the MAX7219 modules are cheap - or were until the Covid isolation of China slapped ridiculous postage fees on them - particularly compared to Adafruit.
I dont thik i will need 12 modules chained in any way, so no problem there! Yes, adafruit is quite expensive, their 4 digit displays are awesome (Lucky Light, also china) and the price reasonable. Managed to find cheap MAX modules with 10mm digits from AZ Delivery, but its a real pain to de-solder and then install larger displays. On the other hand, if it's just plug and play it wouldn't be interesting
Covid made a lot of mess and delivery of cheap parts suffers just as bad.
Also, i've read somewhere is should add 10uF pot below that D1 diode? Can i use ceramic pot and what it does actually? since i've removed D1 the entire module and the chip now heats up...
Many thanks,
Alek
The 10 µF capacitor across the supply and ground is indeed recommended in the datasheet (page 10) in addition to the 100 nF capacitor "C1". Whether that is required on every module or just every 3 or 4 is debatable.
There is no reason why anything should heat up excessively if it is actually being powered by 5 V in the right polarity and the display should be working. At full illumination of all digits however the current draw will be about 280 mA and for a red display, the MAX7219 will be dissipating the bulk of 1.4 W but with no digits lit the power dissipation is pretty negligible.