Native C SDK for connecting Raspberry Pi Pico W devices to SinricPro smart home platform.
- Native pico-sdk implementation (C11)
- WebSocket client with TLS support
- Compatible with Alexa, Google Home, and SinricPro app
- Low memory footprint
- Polling-based architecture (no RTOS required)
- Switch - Simple on/off control for relays, smart plugs, etc.
- DimSwitch - Dimmable switch with power level control (0-100%)
- Light - RGB+CCT smart light with full color and color temperature control
- On/off control
- Brightness adjustment (0-100%)
- RGB color (0-255 per channel)
- Color temperature (2200K-7000K warm to cool white)
- Fan - Speed control for fans and ventilation systems
- On/off control
- Speed adjustment (0-100%)
- Lock - Smart lock control for doors and access control
- Lock/unlock commands
- Status reporting (LOCKED/UNLOCKED/JAMMED)
- GarageDoor - Garage door opener control
- Open/close commands
- Position status monitoring
- Blinds - Motorized blinds/shades position control
- Position control (0-100%, where 0=fully open, 100=fully closed)
- Relative adjustments ("open blinds 30 percent")
- Motion Sensor - PIR motion detection for automation and security
- Temperature Sensor - Temperature and humidity monitoring
- Contact Sensor - Door/window open/close detection
- PowerSensor - Real-time power consumption monitoring
- Voltage, current, power measurements
- Watt-hours energy tracking
- Power factor calculation
- AirQualitySensor - Air quality monitoring
- PM1.0, PM2.5, PM10 particulate matter detection
- Air quality index (AQI) reporting
- Doorbell - Doorbell press notifications
- Push notifications on doorbell press
- Automation triggers
All devices support:
- Voice control via Alexa and Google Home
- SinricPro mobile app integration
- Alexa routines and automations
- Real-time status updates
The following complex devices require additional capabilities and are planned for future releases:
- TV - Television control (requires 8 capabilities)
- Speaker - Smart speaker control (requires 7 capabilities)
- WindowAC - Window air conditioner control (requires 5 capabilities)
- Camera - IP camera streaming (requires specialized camera capabilities)
- 📚 Quick Start Guide - Get started in 10 minutes
- 🔧 Troubleshooting - Common issues and solutions
- 🤝 Contributing Guide - How to contribute
- 📖 API Reference - Detailed API documentation
- Raspberry Pi Pico W or Pico 2 W
- pico-sdk (1.5.0 or later)
- CMake 3.13+
- ARM GCC toolchain
# Clone the SDK
git clone https://github.com/sinricpro/pico-sdk.git
cd pico-sdk
# Add cJSON dependency
git submodule add https://github.com/DaveGamble/cJSON.git lib/cJSONexport PICO_SDK_PATH=/path/to/pico-sdkmkdir build && cd build
cmake ..
makeHold BOOTSEL button, connect Pico W via USB, then:
cp examples/switch/sinricpro_switch_example.uf2 /media/$USER/RPI-RP2/#include "sinricpro/sinricpro.h"
#include "sinricpro/sinricpro_switch.h"
sinricpro_switch_t my_switch;
bool on_power_state(sinricpro_device_t *device, bool *state) {
printf("Power: %s\n", *state ? "ON" : "OFF");
gpio_put(LED_PIN, *state);
return true;
}
int main() {
sinricpro_config_t config = {
.app_key = "your-app-key",
.app_secret = "your-app-secret"
};
sinricpro_init(&config);
sinricpro_switch_init(&my_switch, "your-device-id");
sinricpro_switch_on_power_state(&my_switch, on_power_state);
sinricpro_add_device((sinricpro_device_t *)&my_switch);
sinricpro_begin();
while (1) {
sinricpro_handle();
sleep_ms(10);
}
}The SDK includes complete examples for all device types:
examples/switch/- Basic on/off relay controlexamples/dimswitch/- Dimmable LED with PWM controlexamples/light/- RGB+CCT LED strip with full color controlexamples/fan/- PWM fan speed control with automatic cyclingexamples/lock/- Solenoid lock control with manual unlock buttonexamples/garagedoor/- Garage door relay control with position sensorexamples/blinds/- Motorized blinds with time-based position tracking
examples/motion_sensor/- PIR motion detectionexamples/temperature_sensor/- Temperature/humidity monitoring (uses built-in RP2040 sensor)examples/contact_sensor/- Door/window sensor with magnetic reed switchexamples/powersensor/- Real-time power monitoring with ADC voltage/current sensingexamples/airqualitysensor/- Air quality monitoring with I2C PM sensor
examples/doorbell/- Doorbell button with buzzer chime
Each example includes:
- Complete working code with detailed comments
- Hardware connection diagrams in comments
- Voice command examples
- Configuration instructions
- Create an account at sinric.pro
- Create a device in the dashboard
- Copy your App Key, App Secret, and Device ID
- Link your SinricPro account with Alexa or Google Home
MIT License - see LICENSE file
- 💬 Discord Community - Chat with other users
- 🐛 Report Issues - Bug reports and feature requests
- 📧 Support - Contact SinricPro support