Falcon Christmas

The Lab (Technical Talk) => New Hardware Projects => Topic started by: TexasStingray on January 19, 2018, 11:33:49 AM

Title: PiUPShield - Looking for Input
Post by: TexasStingray on January 19, 2018, 11:33:49 AM
Wanted to get a group discussion started here about having a Pi HAT/Shield here that would be a battery backup for you pi that would trigger a GPIO that would let the pi know that it is running on battery power to take action. I think that it would require 2 GPIO's so that the shield knows when the Pi has shut down so that it removed the batteries power from the pi so that when the mains power is back it triggers a start of the Pi.
Title: Re: PiUPShield - Looking for Input
Post by: Bwinter on January 19, 2018, 11:37:20 AM
What type of "action" would it take if it recognized it's on battery?


If the Pi is "shut down," how would a GPIO trigger it to start back up?
Title: Re: PiUPShield - Looking for Input
Post by: TexasStingray on January 19, 2018, 12:19:35 PM
Action would depend on the script, but in most cases if there is no mains power then there is not enough power to run the light show show it should shut down. The Pi by default when power is applied to it would power on. So when the mains power is on then the pi would start up as usual. Then when the mains power is cut off for some reason the shield would kick in keeping the pi up and triggering the GPIO which the script would recognize and take action. Then when the 2nd GPIO goes LOW because the pi is shutdown the shield would have to kill its power going to the pi, so that when the mains power does come back on it would trigger a normal startup.
Title: Re: PiUPShield - Looking for Input
Post by: CaptainMurdoch on January 19, 2018, 12:58:35 PM
This sounds like a good idea to me.  There are some commercially available solutions, but they seem to cost as much as or more than the Pi.
Title: Re: PiUPShield - Looking for Input
Post by: k6ccc on January 19, 2018, 02:37:14 PM
I'm watching this thread...  Very interested to see where this goes...
Title: Re: PiUPShield - Looking for Input
Post by: TexasStingray on January 19, 2018, 03:34:58 PM
Looking for the developers out there that have developed HATS for the Pi, that have made them available to others! What GPIO pins are available for use?
Title: Re: PiUPShield - Looking for Input
Post by: CaptainMurdoch on January 19, 2018, 05:24:46 PM
Most of the pins used by the various Hats are documented on the Channel Outputs popup help page in FPP.  The RGBMatrix output needs updating as it now can use almost all the pins to drive the 3 chains of LED panels.

If you are looking for pins to avoid, avoid the PCM and i2c pins unless you need i2c.  The newer version of the ws281x library has the option of using those to drive pixels and I may see if I can drive 4 strings of pixels off the Pi at one time using those and the two PWM outputs we currently use.
Title: Re: PiUPShield - Looking for Input
Post by: TexasStingray on January 19, 2018, 06:41:41 PM
Maybe i should allow the user to set jumpers for the pins to use?
Title: Re: PiUPShield - Looking for Input
Post by: Bwinter on January 19, 2018, 06:47:44 PM
Most of the pins used by the various Hats are documented on the Channel Outputs popup help page in FPP.  The RGBMatrix output needs updating as it now can use almost all the pins to drive the 3 chains of LED panels.

If you are looking for pins to avoid, avoid the PCM and i2c pins unless you need i2c.  The newer version of the ws281x library has the option of using those to drive pixels and I may see if I can drive 4 strings of pixels off the Pi at one time using those and the two PWM outputs we currently use.

Wait....youíre saying the Pi could potentially drive 4 WS281x strings, instead of just the two that weíre accustomed to??
Title: Re: PiUPShield - Looking for Input
Post by: CaptainMurdoch on January 19, 2018, 06:51:41 PM

Wait....youíre saying the Pi could potentially drive 4 WS281x strings, instead of just the two that weíre accustomed to??

I am not sure yet but the possibility exists.  I believe the updates version of the library supports outputs over PWM, PCM/SPI, and i2c but I am not sure if it can do all at the same time.  Even if it can't, do all at the same time, I want to explore using the other outputs.  The advantage of using those will mean you could still use the onboard PWM audio while driving pixels at the same time.
Title: Re: PiUPShield - Looking for Input
Post by: Bwinter on January 19, 2018, 07:03:26 PM
How soon would this be implemented?  In enough time to develop new boards that could take advantage of this for the upcoming season?
Title: Re: PiUPShield - Looking for Input
Post by: CaptainMurdoch on January 19, 2018, 07:36:06 PM
How soon would this be implemented?  In enough time to develop new boards that could take advantage of this for the upcoming season?

I plan on upgrading the library used in the master branch sometime soon and will then regression test the existing PWM method and also test the new output methods to get them working and see if I can drive 3-4 at the same time.
Title: Re: PiUPShield - Looking for Input
Post by: TexasStingray on January 21, 2018, 01:47:20 PM
Working on this and having a great time learning. Using a breadboard I've been able to run my Pi Zero W with the main power and the power pack hookup up at the same time and when i cut the main power the pi keeps on running off the power pack. Using FPP GPIO I've been able to trigger a shutdown script. Next is to edit the script to check to wait some period of time and see if the main power is still off or take action.
have been able to run
Title: Re: PiUPShield - Looking for Input
Post by: Bwinter on October 12, 2018, 10:42:49 AM
Most of the pins used by the various Hats are documented on the Channel Outputs popup help page in FPP.  The RGBMatrix output needs updating as it now can use almost all the pins to drive the 3 chains of LED panels.

If you are looking for pins to avoid, avoid the PCM and i2c pins unless you need i2c.  The newer version of the ws281x library has the option of using those to drive pixels and I may see if I can drive 4 strings of pixels off the Pi at one time using those and the two PWM outputs we currently use.


Was this ever implemented?  Can a RPi now drive 4 separate ws281x outputs?
Title: Re: PiUPShield - Looking for Input
Post by: Bwinter on December 26, 2018, 06:24:22 PM
How soon would this be implemented?  In enough time to develop new boards that could take advantage of this for the upcoming season?

I plan on upgrading the library used in the master branch sometime soon and will then regression test the existing PWM method and also test the new output methods to get them working and see if I can drive 3-4 at the same time.

Still curious on where this project ended up (the ability to drive 3-4 strands off a Pi).
Title: Re: PiUPShield - Looking for Input
Post by: CaptainMurdoch on December 26, 2018, 10:33:11 PM
Still curious on where this project ended up (the ability to drive 3-4 strands off a Pi).

We are using the updated version of the library in FPP v2.x, so we should be able to support the PCM and SPI outputs with some code modifications in the RPIWS281x Channel Output class and UI.  It looks like the library auto detects which mode to use by looking at the GPIO pin that you tell it to use.  Right now, we have the GPIO outputs hardcoded for 18 and 19.  If you want to test a 1-line source change, you should be able to see if the library will work with FPP as-is.  I can tell you what line to modify and the value to use to test PCM and the value to use to test SPI.  If those work individually, then I can do some more testing to see if we can run multiple PWM/PCM/SPI at the same time.  Right now we have an instance of a ws2811_t struct that we have to pass to the library to initialize it.  I don't know if the library supports multiple instances of this struct or not, that is the more complicated test.  I read through some of the commits and the README for the library, but can't find anything that says it will or won't support multiple outputs at the same time.
Title: Re: PiUPShield - Looking for Input
Post by: Bwinter on December 27, 2018, 10:35:17 AM
Once I wrap up this season, Iíd definitely be interested in testing this out.
Title: Re: PiUPShield - Looking for Input
Post by: dkulp on December 29, 2018, 10:44:42 AM
If you need more than 2 strings off of an FPP instance, aren't you better off with a BBB (can run 54 strings) or PocketBeagle (36 strings)?
Title: PiUPShield - Looking for Input
Post by: Bwinter on December 29, 2018, 11:30:58 AM
Well, I donít technically *need* 4-outputs, but they would be nice to have (and I would certainly use them if available).  Iím already settled in the Pi environment (I have 20+ of various models)óso I really donít want to drop those, only to stock up on something else.  And Iím comfortable enough with the nuances of them (I.e., power, audio, video, etc).
Title: Re: PiUPShield - Looking for Input
Post by: Bwinter on December 29, 2018, 12:30:15 PM
If you need more than 2 strings off of an FPP instance, aren't you better off with a BBB (can run 54 strings) or PocketBeagle (36 strings)?

Iím also honestly confused here:  if I wanted to run 36+ strings, wouldnít I be better off with a F16?  Then again, why would I settle for 16 when I could get 36 (2x the outputs at a fraction of the cost)?  Sure, the F16 has does bells-and-whistles (which Iíve never needed), but the numbers donít make sense (in my mind).

And this is also why I just stick to the PiHat environmentóit makes sense to me...
Title: Re: PiUPShield - Looking for Input
Post by: dkulp on December 29, 2018, 04:52:18 PM
If you need more than 2 strings off of an FPP instance, aren't you better off with a BBB (can run 54 strings) or PocketBeagle (36 strings)?

Iím also honestly confused here:  if I wanted to run 36+ strings, wouldnít I be better off with a F16?  Then again, why would I settle for 16 when I could get 36 (2x the outputs at a fraction of the cost)?  Sure, the F16 has does bells-and-whistles (which Iíve never needed), but the numbers donít make sense (in my mind).


Kind of depends...  With an F16, you would still need e1.31 or similar to get data there.   You wouldn't need that with a BBB as it's a full FPP instance that can run in remote more.   Basically, the BBB+Cape's are EXACTLY like the Pi+Hat, just more capable.  With FPP 2.x, they are really configured exactly the same.  Same FPP image install instructions, same interface for configuring strings, etc....   
Title: Re: PiUPShield - Looking for Input
Post by: dkulp on December 29, 2018, 04:54:28 PM



I should also note that none of the capes for the BBB use the BBB to their full potential.   The F8-PB only exposes 8 ports (of the 36) directly with fuses and such.   The others are either via differential outputs (12 strings) or a 16 port expansion header.   I did create a F32-B at one point, but not many people were interested in that many strings in one spot so I didn't sell many. 
Title: Re: PiUPShield - Looking for Input
Post by: Bwinter on December 29, 2018, 06:16:02 PM
Yeah, Iím s big fan of the hat/cape concept and not needing a separate device to connect/Output e1.31.

Iíve developed my own 2-data/power and 2-power-injection output boards for PiZeroW, and separate boards for my icicle distribution (also based on a PiZeroW).  Sounds like I should have started going down the BBB path earlier. Too late now
Title: Re: PiUPShield - Looking for Input
Post by: CaptainMurdoch on January 23, 2019, 05:10:17 PM
We are using the updated version of the library in FPP v2.x, so we should be able to support the PCM and SPI outputs with some code modifications in the RPIWS281x Channel Output class and UI.  It looks like the library auto detects which mode to use by looking at the GPIO pin that you tell it to use.  Right now, we have the GPIO outputs hardcoded for 18 and 19.  If you want to test a 1-line source change, you should be able to see if the library will work with FPP as-is.  I can tell you what line to modify and the value to use to test PCM and the value to use to test SPI.  If those work individually, then I can do some more testing to see if we can run multiple PWM/PCM/SPI at the same time.  Right now we have an instance of a ws2811_t struct that we have to pass to the library to initialize it.  I don't know if the library supports multiple instances of this struct or not, that is the more complicated test.  I read through some of the commits and the README for the library, but can't find anything that says it will or won't support multiple outputs at the same time.

Just a follow-up on this.  I updated the rpi_ws281x.cpp Channel Output code to allow specifying the GPIO number in the co-pixelStrings.json config file.  I also updated it to allow multiple instances of the RPIWS281xOutput class for testing purposes.  I tried using the SPI output and the PWM output at the same time and I did get lights blinking when using the SPI output, but there was noticeable interference.  I compiled fppd without WiringPi support and still saw what looked like some interference when using the SPI output and the PWM outputs at the same time.  I'm not sure if this is because it is a limitation or if there is something else pinging the SPI bus that is causing the hiccups.  I pushed the code to master along with comments on how to update the co-pixelStrings.json file to test further combinations.  I also did not test on a newer B+/2B/3B/3B+, my testing was on an original v1 B, so I couldn't test the PCM output which uses GPIO 21 on pin 40.  I still think that a BBB or F4v3 are the better solution if you need 3-4 strings, but wanted to see if the additional outputs would work in FPP without a lot of effort.
Title: Re: PiUPShield - Looking for Input
Post by: Bwinter on January 23, 2019, 06:11:25 PM
Interesting....Iíll play around with this