- Project Overview
- Features
- Hardware Preparation
- Step 1: Setting Up Arduino IDE & ESP32 Board
- Step 2: Installing Necessary Libraries & Drivers
- Step 3: Choosing the Board & Partition Scheme
- Step 4: Uploading the Code
- Step 5: RainMaker Cloud Setup & Device Integration
- Technical Details & Code Explanation
- Reset/Boot Button Operation
- Common Issues & Solutions
- Project Photos
- Credits & Further Learning
This project enables smart control of 4 relays with ESP32, using AC appliances locally (manual switches), from the RainMaker app, and voice commands via Google Home and Alexa. The system features state persistence (EEPROM), live feedback, setup by BLE, and robust reset options.
- 4 relay channels: control via mobile app, voice assistant, and physical switches
- Manual On/Off switches for instant local control
- Google Home / Alexa integration (via RainMaker cloud)
- EEPROM state restore: Remembers relay states after power loss
- Real-time feedback: App, voice, and manual sync
- Over-the-air updates (OTA enabled by default)
- Factory & Wi-Fi reset via BOOT button
- Highly commented source code for easy learning
- ESP32 Dev Module (recommended, see below for board selection issues)
- 4-channel relay board
- Momentary push buttons or toggle switches for each relay
- Micro-USB data cable (not just charging; must transfer data)
- Optional: breadboard/jumper wires
1. Download and install the latest Arduino IDE
2. Add ESP32 Board Support
- Go to
File>Preferences>Additional Board Manager URLs - Paste:
https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
3. Open Tools > Board > Boards Manager and search for ESP32 by Espressif Systems, then install it.
4. Select the right board:
- Choose ESP32 Dev Module in
Tools>Board. This board supports partition schemes (critical for large code sketches, see Step 3). - Boards like
DOIT ESP32 DEVKIT V1often lack partition scheme options and can trigger "Sketch too big" errors. If you face this, switch toESP32 Dev Moduleor other board with partition scheme selector ([details in next section]).
Required Libraries:
AceButton(install via Arduino Library Manager or from GitHub)ESP RainMaker(pre-installed as part of ESP32 board support)
USB-To-Serial Bridge Drivers:
- If the COM port does not show up in Arduino IDE, install CP210x driver
- Use a proper micro-USB data cable; charging-only cables will not work for upload
The ESP RainMaker library and multi-relay code require extra firmware space. To avoid "Sketch too big; text section exceeds available space" errors, follow these steps:
- In Arduino IDE, after choosing
ESP32 Dev Module, go toTools>Partition Scheme. - Select:
- RainMaker 4MB No OTA (if you need maximal sketch space and do not use OTA) (It worked for me)
- Tip: Boards without this option (like
DOIT ESP32 DEVKIT V1) can trigger upload errors. Always select a board with partitioning support.
- After compiling, open Serial Monitor and set the baud rate to
115200(matching the code). - During upload, if you get a connection error, hold down the BOOT button on your ESP32 and release when the writing starts
- Commented code aids debugging—no line left unexplained.
- Install the ESP RainMaker app on your phone.
- Provision the device:
- Use BLE onboarding—app will connect to ESP32.
- If your WiFi network doesn't appear in the app, use "Join other network" and enter SSID/password manually (RainMaker only supports 2.4 GHz WiFi).
- Device appears in app after provisioning.
- Integration with Google Home / Alexa:
- Install and sign in to the Alexa app on your phone (Android/iOS).
- Open the ESP RainMaker app and ensure your devices are visible and working.
- Go to app settings in ESP RainMaker.
- Tap the "Settings" gear icon.
- Locate and select "Voice Services."
- Tap "Amazon Alexa" and then "Link with Amazon Alexa."
- Sign in with your ESP RainMaker credentials when prompted.
- Follow the on-screen instructions to finish linking. The Alexa app will now automatically discover your ESP RainMaker devices.
- Your "Switch1", "Switch2", etc. will appear as controllable devices.
- Test voice commands, e.g., "Alexa, turn on Switch1."
Tips:
- Make sure device names in your code ("Switch1" ...) are easy to pronounce.
- Linking must use the same account/email on both RainMaker and Alexa for device discovery to succeed.
- Install and sign in to the Google Home app on your phone.
- In Google Home, create a new Home if you haven't already.
- Tap "+" (Add) in the top left corner and choose Set up device → Works with Google.
- In the search bar, type "RainMaker" and select ESP RainMaker.
- Sign in with your ESP RainMaker account.
- Grant permissions and complete the linking process as instructed. Your devices will be imported - you should now see them in the Google Home dashboard.
- Test with "Hey Google, turn on Switch1" or similar commands.
- Every important section in the code is commented, explaining:
- ACEButton handling for manual switch logic
- EEPROM integration for state restoration
- Active LOW relay signaling
- RainMaker app/voice control callback
- WiFi/BLE provisioning and troubleshooting
- See source code for full walkthrough.
- Boot/Reset Button <3s: No effect
- Press for 3s - 10s: Triggers WiFi reset; ESP32 loses WiFi credentials and needs reprovisioning (app pairing stays)
- Press for >10s: Triggers Factory reset; complete wipe of all configs, ESP32 needs full re-setup through RainMaker app
- Partition scheme errors: If "Sketch too big," switch board type or partition scheme as described in Step 3.
- Board detection/COM port: Use CP210x driver and proper cable ([setup instructions]); if upload fails, check RESET/BOOT button procedure.[5][1]
- RainMaker WiFi onboarding issues: App can't find SSID? Use manual network entry and verify you're on a 2.4 GHz WiFi network.
- WiFi/BLE provisioning bug: If you see errors for undefined
WIFI_PROV_SCHEME_*flags, update toNETWORK_PROV_SCHEME_*family as used in code. This is the issue I solved in the original code from the video.
- Code based on
- Video tutorial by Tech StudyCell: ESP RainMaker + Manual Switch/EEPROM | YouTube
- If you prefer a guided walkthrough, watch the above video.
- For ESP32 and Arduino IDE setup step-by-step, see:
- For technical help and bug fixes, see code comments and the Common Issues and Solutions section