-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PCA9685 and HT16K33 Not Working Together #1591
Comments
It seems plausible that there could be a bug that just hasn't popped up before. I don't think many people have tried using multiple I2C devices yet. I'll test out the Johnny-Five side tonight. We may need to enlist @nebrius if it works in Johnny-Five w/o raspi-io. |
Great thank you! I am going to start digging into the code tonight and try it on an arduino as well. |
Sorry it took a while. I tested with what I have and I see that the I2C writes to the PCA9685 do not stop after the matrix is initialized so that eliminates Johnny-Five as the cause of that particular problem. I do think I see another, altogether different bug. While the strobing works, are you seeing the colors you expect? |
No worries and thanks again for the help! While strobing it looks like the colors are correct. |
Ok I tested it using an Arduino Mega and connecting the PCA9685 to it and an rgb led connected to that. Works fine. Chained the HT16K33 to the PCA9685 and getting the same results. Here is a vid of what's happening: |
Wow, thanks for the video! It looks like the TX/RX LEDs on the UNO are still blinking on the correct interval, even after the RGB LED stops responding, so I assume the writes are still happening. I wonder if the I2C address of the PCA9685 is getting stepped on in J5 when we initialize a second device. I admit I didn't look at the address when I looked at the I2C messages. I'll check that out tonight. |
You are correct about the led calls still being made. After the matrix is cleared and writes out, the blink method of the RGB is still be called. I have traced all the way into the j5-io library so far and the i2cwrite method is still being called (I just have the led blinking red at this point): i2cWrite(address, registerOrInBytes, inBytes) output: i2cwrite 64 [ 6, 4096, 16, 0, 0 ] undefined And I'll admit I didn't check the address, either :) Was going to try and dig in a little further tonight. |
Now that I've seen the wiring, I wonder if it could be a power issue. You're not using an external power supply on the PCA9685 so the Uno, the PCA9685, the RGB LED, and the LED Matrix are all drawing power from your USB port which is capped at 500ma. I couldn't find specs on the matrix power draw, but if it's about 20ma per LED and you're turning on 16 of them, that 320ma plus another 20 or so for the RGB LED and I don't know how much for the PCA9685 and the Uno, so all that could be adding up and overloading your USB port. Maybe the PCA9685 is "smart" and shuts itself off in low power situations. While I couldn't find anything on Adafruit's site about the current draw for the matrix, I did see in this instructable that an external 5V, 1A power supply is recommended. When you add an external power supply, make sure you add resistors on your LED so nothing bad happens to it. |
ah that's a good point. The pca has a VCC terminal, let me try hooking up a power supply to that and running the matrix and led from it. |
Well...connected a 5V 1A power supply to the PCA9685 and am powering the led matrix from that, but same results. I also connected the positive lead directly to the matrix and still the same. |
Bummer. Okay, I've ordered my own so I can replicate the problem. It should be here late next week. |
No worries and I'll keep digging. Thank you for the help!
…On Fri, Aug 9, 2019, 7:53 AM Donovan Buck ***@***.***> wrote:
Bummer. Okay, I've ordered my own so I can replicate the problem. It
should be here late next week.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1591?email_source=notifications&email_token=ACXGD775LOK6STXHOLGBJHTQDVSFRA5CNFSM4II2FE2KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD36STYY#issuecomment-519907811>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ACXGD76G2USOSVIK6NWUKETQDVSFRANCNFSM4II2FE2A>
.
|
@dtex I think I'm getting closer. I've traced down to where the data is being sent to the board in firmata-io/firmata.js. When just the LED on the PCA9685 is blinking the i2cRequest method in firmata-io/firmata.js around line 2531 has an active board state of:
(where 64 is the address of the PCA9685) When the writes to the HT16K33 kick in, the active board state looks like this:
And it looks like only the second board is being written to. I'm still trying to track this down, but just wanted to update you in case you got started. |
Just wanted to let you know everything showed up and I got it all soldered together. I am seeing the same behavior. Diving in... |
I need to get some sleep, but tomorrow evening I will try changing things on the J5 side so that i2c_config is sent only once. I'm also going to try a different i2c device (instead of the PCA9685). |
Great thanks for the update. I think I got about as far as you and have not had time to continue. Hoping to get back to it in the next couple of days! |
I was able to use another i2c device in concert with the matrix and both worked fine, but I could not use the other device with the PCA9685 (same result). I think my next test will be to create an Arduino C sketch that does essentially the same thing as your program and see if that works. I did find some folks who were talking about PCA9685 freezes and attributing it noise on SDA/SCL that could be fixed with pull-up resistors. The Arduino, of course, has pull-up resistors that are used for i2c, but some folks said those resistors were not adequate. |
Ah...that makes a lot of sense. This is my first time working with PCA9685, and after reading your response and doing some research I found several sources that talked about how the signal gets dirtier the longer your chain gets (event though my chain is "2" at this point...) I found some hopefully usable info here: http://dsscircuits.com/articles/effects-of-varying-i2c-pull-up-resistors https://community.particle.io/t/has-anyone-used-the-adafruit-pca9685/15539/7 I have another PCA9685 that I will try instead of the HT16K33 so see if that makes a difference, and will also try the pull-up resistors on the SDA and SCL lines. |
Well...still no joy :( I hooked up various resistors from 220 Ohm to 4.7k to pull-up from 5V for SDA and SCL and still same results. Also tried on 3.3V just for grins... Will keep experimenting. |
Ok...little bit of progress. Hooked up another PCA and got interesting results :) I didn't mention in the vid but the first 9685 is at address 0x40 and the second is at 0x41 |
I put together a little test sketch and it works when running on the arduino https://www.youtube.com/watch?v=s96KGc0Ludk So the problem could be in firmata, node-serialport, firmata.js or Johnny-Five but you saw the same results on the Pi with raspi-io correct? |
I think I've got it! The PCA9685 is being configured to listen to all commands regardless of address. Try this and let me know if it works... In this.io.i2cWriteReg(this.address, this.REGISTER.MODE1, 0xa1); to: this.io.i2cWriteReg(this.address, this.REGISTER.MODE1, 0xa0); That should fix both Arduino and Raspberry Pi. If that works, I'll get a PR in. |
I ported this bug from Adafruit's library to J5 back in 2014. @ladyada fixed it last year but I didn't get the memo 🤷♂ adafruit/Adafruit-PWM-Servo-Driver-Library@9f8e1dd#diff-5d1e3a5213c0ef6dedb2baf5cc323727L106-R110 |
Addresses rwaldron#1591
Boom! Yes! That did it! Thank you! I tested on both the Rpi and arduino and they both are working great! |
Awesome! Thanks for your patience and thank you for discovering and reporting this bug. The videos were super helpful. I'll get a PR in this morning. |
Happy to help! |
…sses Issue description: I'm combining my PCA9685 with HT16K33 8x8 matrix. As soon as I send a command to the HT1633 the PCA stops responding and all my connected servos go limp. The solution for this issue was identified here: rwaldron/johnny-five#1591 (comment) It appears the issue was fixed in the arduino library but not corrected in circuit python (see adafruit/Adafruit-PWM-Servo-Driver-Library@9f8e1dd#diff-5d1e3a5213c0ef6dedb2baf5cc323727L106-R110) I confirmed the fix below works for me: Change line 163 of adafruit_pca9685 in frequency(self, freq) from self.mode1_reg = old_mode | 0xa1 # Mode 1, autoincrement on to self.mode1_reg = old_mode | 0xa0 # Mode 1, autoincrement on, fix to stop pca9685 from accepting commands at all addresses I will submit a pull request with this change.
I have the PCA9685 16 channel I2C interface board and the 8x8 led matrix (using HT16K33) from Adafruit. I cannot get both of them working together.
The PCA9685 is controlling an RGB Led and I have it switching colors every second. Whenever I do anything with the 8x8 (HT16K33), the LED just freezes at the current color and does nothing. The 8x8 led works fine in all cases.
The address of the PCA9685 is 0x40 and the LED matrix is at 0x70. I'm running this on a Raspberry Pi Zero W using Raspi-IO.
I've tried connecting the 8x8 to the pass-thru headers of the PCA9685 and also running the SDA/SCL (as well as VCC and GND) into a bread board and then hooking the 8x8 and PCA up to the breadboard. Same results.
It seems the HT16K33 is blocking the PCA9685 somehow?
Here is the code:
The text was updated successfully, but these errors were encountered: