I’m working on some Christmas tree lights using Neopixels controlled by a Plasma 2040 (not the wireless version). They’ll mostly be controlled by the Plasma, which is a Pimoroni RP2040 board, but I’d also like my Raspberry Pi 4 to send messages that alter the lights, e.g. telling the Plasma what music is playing.
I’ve already been communicating from a PC to the Plasma by USB over serial, and it also supports I²C; but I don’t think it has SPI or UART exposed. I’m quite new to electronics hacking, and I’m concerned about power between the separate devices. The Plasma says it can handle up to 3A over USB-C, which should be plenty for the lights (although I’ve not sorted out the resistance over the long wire yet, so it’s effectively capping around 0.9A), but powering the whole thing from the Pi’s USB port is out of the question.
Would I be best off sticking with USB for communication and using a separate power supply for the LEDs, or connecting the Pi and Plasma with I²C and using a USB power supply for the Plasma and its LEDs? In either case, how do I deal with the separate power supplies? I read that I²C is designed for a single circuit board and works best with a shared ground - can that cause problems on separate boards like this? Or if I use a separate power supply for the LEDs, would I again need a shared ground between the Plasma and the LED power?
I think I asked a similar question last year, but I didn’t get round to it at the time. Now I’ve done a little more planning, and the idea of soldering no longer terrifies me :-D
A small aside, are there any adapters that let me connect two sections of Neopixels and attach extra power, neater than soldering two or three cables together?
I ran into a similar issue with my Interstate 75 W. I have two 64x32 panels for 128x32 total LED’s. I power it with a 5V 4A power supply wired to the dedicated power connectors on its back side. It powers the LED’s and the Pico w.
Problem is, that +5V also appears at the Micro USB port on the Pico W. If I connect a device for programing the two 5V sources will fight each other trying to regulate the 5v Bus. If I unplug the dedicated power supply the PC power via USB isn’t enough to power the Interstate 75 and LED’s?
So what I did was modify one of my Micro USB cables. I cut the Red +5V wire, leaving just the Data +, Data - and Ground. The dedicated 5V supply can stay plugged in. The USB signaling is fine, and no magic blue smoke to ruin my day. I used a yellow USB cable, that way I know the yellow cable with the black tape on it, is the custom one. ;)
GP21 is used for I2C0 SCL and GP20 is used for I2C0 SDA.
And as far as I know those pins on the RP2040 can also be used for
GP21 UART1 RX and GP20 UART1 TX
It would take some coding to set it up and test it out. I’m thinking that would still be easier than trying to do i2c signalling between the two devices.
Interesting, in your experience are USB wires colour coded, or are some specifically made for modification? I should have an old cable lying around if I didn’t bin it already (plug won’t hold itself in my phone any more) that I can experiment with, although I’ll need to get a longer one for the final project.
I might also give UART a go, although I’d need to move the project over to the Pi instead of working from my PC as I am now.
It’s been my experience that the USB cable wires are color coded, with Red being the +5V. I’ve cut open a couple and Red has been the +5V and Black the Ground wire. The data wires vary a bit, yellow, blue, green, or white.
Two things to note: first, always connect your grounds. Unless you really, really know what you are doing. Connecting your grounds does no harm. And this is not only because of I2C.
Secondly, GPIO20/21 does not support UART.
So for communication, using Pi (USB) → Pico (USB) for UART is possible and the trick from @alphanumeric with the manipulated cable is useful (it also gives you the common ground).
Communication using I2C is also possible, but you have to implement device-mode I2C for the Pico and “invent” your own protocol. You will find example code for this on the net.
I don’t understand Pimoroni why they limit these Plasma-sticks to one single task (the PlasmaW is even worse) wasting all the power of the Pico, but we have to make the best of it.
Great, thanks. I was a bit concerned that connecting part of the power (which is what I sort of thought connecting the ground would be) might be bad, but I’ve seen it in enough places that it sounds right now. Definitely seems like serial over USB is the way to go, especially as I’ve already got it working. Thanks for the advice, I’ll post something over in the projects forum if and when I get some good results
Yeah, it’s annoying that I don’t have anything other than I²C. I think these specialised boards like the Plasma are designed more for beginners, and maybe I’m starting to outgrow them. I was looking forward to the Plasma W when it was announced, but then I was disappointed because I’m already using a microphone on one of the analogue pins to flash the lights to music.
A lot of these are (IMHO) specialized tech. They do one or two things and do them well. I’m not making excuses for Pimoroni or other retailers, just my 2 cents on it. Trade offs are made for cost and or size all the time in retail.
If your handy with a soldering iron, tacking a few wires onto the Pico W on the Plasma W is an option. All the Plasma part is doing is converting 3V logic to 5V logic for the Data to the LED’s. You could build your own Plasma + , it’s going to be a lot bigger though.
I have two Plasma W’s. I use them to light up two small artificial Christmas trees. They fit nicely inside two plastic pill containers. Right now mine are set and forget. They just light up a particular pattern that my wife really likes. All I have to do is plug them in.
I do have plans to step it up a notch this year and be able to control them over WIFI. Just have to go find my round 2it. ;)