Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bryal/sm2335egh-rs
Driver in Rust for the SM2335EGH 5-channel LED controller
https://github.com/bryal/sm2335egh-rs
Last synced: 26 days ago
JSON representation
Driver in Rust for the SM2335EGH 5-channel LED controller
- Host: GitHub
- URL: https://github.com/bryal/sm2335egh-rs
- Owner: bryal
- License: mit
- Created: 2023-09-28T16:06:30.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2024-02-11T13:51:53.000Z (12 months ago)
- Last Synced: 2024-12-20T23:49:37.932Z (about 1 month ago)
- Language: Rust
- Size: 2.3 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SM2335EGH-rs
A GPIO-based driver for the SM2335EGH LED controller found in the SwitchBot Color Bulb, written in pure no-std Rust.
The SM2335EGH (aka just SM2335) is a 5-channel, 10-bit LED controller made by Shenzen Sunmoon Microelectronics.
[Some details about the chip can be found on their website, chinaasic.com](http://www.chinaasic.com/chipDetails/detail_290.html).
Alternatively, you can find the [document with the specs here in doc/](doc/SM2335EGH-chip-details-ch.pdf).In short, the five channels (called OUT1 through OUT5) are essentially split into two groups.
The first three channels (OUT1-OUT3) are low voltage at 40V and allow a maximimum current of 160mA.
In practice, these three channels are used for RGB / coloured light.
The last two channels (OUT4-OUT5) are much higher voltage at 500V, but the maximum current is halved at 80mA.
These two channels are used for warm & cool white.In my SwitchBot bulbs, this is the concrete channel mapping used:
| Output | Group | Color/hue |
|--------|-------|------------|
| OUT1 | RGB | Green |
| OUT2 | RGB | Red |
| OUT3 | RGB | Blue |
| OUT4 | CW | Warm white |
| OUT5 | CW | Cold white |This chip seems fairly uncommon at this point (2023-09).
At least I'm not aware of any other products than the SwitchBot bulbs that use it.
The specific model number of my bulbs with this chip is W1401400.![Rainbow color cycle on a dismantled SwitchBot Color Bulb connected to a flasher/debugging probe](switchbot-rust-rainbow.gif)
## Implementation
I just based the driver on the ones in [Tasmota](https://github.com/arendst/Tasmota/pull/15839) and [ESPHome](https://github.com/esphome/esphome/pull/3924). I've asked the manufacturer for more information about the protocol, just to have a first hand source, but I'm not particularly worried about bugs. The protocol as found in the Tasmota and ESPHome implementations is really simple, and I haven't had any issues in practice.
However, if you happen to have access to the protocol specification, please contact me! Similarly, if you've spotted an issue in the current implementation -- don't hesitate to open an issue (or even better, a PR).
## License
The MIT License (MIT). See [LICENSE](LICENSE).