Skip to content
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

WS2812B RGB mod for Pinecil V2 #1739

Open
doegox opened this issue Jul 9, 2023 · 8 comments
Open

WS2812B RGB mod for Pinecil V2 #1739

doegox opened this issue Jul 9, 2023 · 8 comments

Comments

@doegox
Copy link
Contributor

doegox commented Jul 9, 2023

Hello,

Here is a little mod to add a WS2812B to a Pinecil V2.
Obviously, it works better with the transparent shell!

Pinecil V2 has a free GPIO_12 accessible through TP10.
I'm using it to drive a WS2812B and let the color logic already present for the MHP30 do its magic:

  • green when temperature is safe (< 55°C)
  • pulsing red when heating
  • solid red when desired temperature is reached
  • orange when cooling down (appears white on the video due to white balance)
VID_20230709_232437.2.mp4

Electrical setup:

  • WS2812B requires a Vdd between 3.5 and 5.3V and Vih (high level of input signal) must be at least 0.7Vdd
  • GPIO levels are 3.3V
  • The 5V rail is actually max 4.6V

So we can directly power the WS2812B on the 5V rail and command it with the GPIO without need for a level shifter, or for a Zener diode to clamp Vdd.

Screenshot from 2023-07-09 23-46-50

  • Vss(3) is connected to GND, e.g. on the U10 pad mentioned and illustrated here
  • Vdd(1) is connected to the "5V" rail, e.g. on the capacitor mentioned and illustrated here
  • Din(4) is connected to TP10

Connections are made with 0.1-mm enameled wire and isolated with UV glue to avoid any shortcut (my WS2812B is not attached and could move around)

Patch is in a branch of mine for now: https://github.com/doegox/IronOS/tree/pinecilv2_ws2812b and the changes are visible in this commit
The driver is heavily based on WS2812.h by Ralim for the MHP30, but adapted for the RISC-V. Timings are not super precise but, well, it works...

To compile with this feature: make firmware-EN model=Pinecilv2 ws2812b_enable=1

Have fun!

@Lennervh
Copy link

nice mod but how do you solder the wires on the PCB when it is your only soldering iron?🤯

@Lennervh
Copy link

I have a problem that the led flickers instead of pulsing when heating up

@doegox
Copy link
Contributor Author

doegox commented Jul 21, 2023

Maybe my crude bitbang timings are not good enough for your WS2812B.
You may try to monitor the signal with an oscilloscope and adjust the delay loops to be closer to the specs timings.

@Lennervh
Copy link

I do not have an oscilloscope, is it possible to guess the values? Any idea what values i should try?

@doegox
Copy link
Contributor Author

doegox commented Jul 23, 2023

no :(
an oscillo is needed to measure precisely the duration of how and high pulses and then adapt code experimentally until durations correspond as close as possible to the ones expected by WS2812B.
BTW are you sure LED is a WS2812B?
Besides flickering the LED has the proper colors ? (green when plugged, red when hot, orange when cooling down)

@Lennervh
Copy link

Lennervh commented Jul 23, 2023

the colors are correct the LED is a WS2812B but i used TP14 instead of TP10, change the gpio number in the pins.h
TP10 - TP14 should be available to use

@doegox
Copy link
Contributor Author

doegox commented Jul 23, 2023

Should be... but I didn't test it. Could you test with TP10 instead?
You made a change, the first thing is to see if that change is the source of the problem or not...

@t3chguy
Copy link

t3chguy commented Jan 18, 2024

TP11 and TP12 aren't usable as they're on the other side of a DNP

image

TP9 is usable though is under the screen, it is on the other side of the R42 DNP from TP11.
I ended up going with TP9 after TP10 broke off during my hooking up an oscilloscope to it. Turns out the build system has changed significantly and passing build flags wasn't working like before so I was probing a pinecil which wasn't trying to light an LED - D'oh. Got there eventually. TP10 shall forever be missed. My old iron is not cut out for fine work.

After much pain I got the RGB working and it is great, thanks for your initial effort @doegox

I see no flickering and it works very nicely.

I rebased the commit and hardcoded the ws2812 support on for pinecil v2 to workaround the build system changes. https://github.com/t3chguy/IronOS/actions/runs/7573719952 has artifacts for if anyone else wants to hook it up to TP9, and https://github.com/t3chguy/IronOS/actions/runs/7573047803 for TP10.

20240118_131142
20240118_133217

(Pictures from before the TP10 disaster, and before I shortened the wires and removed most of the kapton)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants