This Node-RED flow implements a complete satellite antenna rotator controller system designed to run on a Raspberry Pi. It provides manual control, automatic tracking, position sensing, calibration, safety timeouts, and integration with external tracking software via standard protocols.
The system controls a dual-axis (azimuth and elevation) antenna rotator using Raspberry Pi GPIO pins. Position feedback is provided by analog potentiometers connected through an ADS1115 ADC. The controller supports both manual operation via a web dashboard and automatic tracking based on target coordinates.
Key features:
- Manual directional control with stop functions
- Real-time position display with gauges
- Calibration for accurate angle measurement
- Automatic tracking with tolerance checking
- Safety timeouts to prevent mechanical damage
- Integration with Hamlib/rotctld and GS-232 protocols
- Email/SMS alerts for timeout events
- Raspberry Pi (any model with GPIO)
- ADS1115 ADC module (for position feedback)
- Dual-axis antenna rotator with:
- DC motors or stepper motors
- Potentiometers for position feedback
- Optional: Serial/USB connection to external rotator controller
Azimuth Control:
- Pin 19: Right rotation
- Pin 6: Left rotation
Elevation Control:
- Pin 21: Up rotation
- Pin 5: Down rotation
- Node-RED
- node-red-contrib-rpi-gpio (for GPIO control)
- node-red-contrib-iiot2k-ads1115 (for ADC reading)
- node-red-contrib-ui (for dashboard)
- node-red-contrib-hourglass (for timing)
- node-red-node-email (for alerts)
The flow is organized into several functional sections:
UI Components:
- Direction buttons: Left, Right, Up, Down
- Stop buttons: Stop Azimuth, Stop Elevation, Stop All
- Sliders for setting target positions
Logic:
- Each direction button sends a "1" to the appropriate GPIO pin
- Mutual exclusion logic ensures opposite directions are automatically turned off
- "Stop All" immediately halts all movement and disables tracking
- UI text displays current movement status ("Moving Right", "Stopped", etc.)
Hardware Interface:
- ADS1115 ADC reads analog voltages from potentiometers
- Continuous sampling every 300ms
Conversion Logic:
- Raw voltage → Calibrated angle using linear interpolation
- Azimuth: 0-360° based on MinAz/MaxAz calibration
- Elevation: 0-90° based on MinEl/MaxEl calibration
Display:
- Compass gauge for azimuth
- Linear gauge for elevation
- Text displays for current and target positions
Calibration Process:
- Position rotator at mechanical minimum
- Press "Set min Az/El" button
- Position at maximum
- Press "Set max Az/El" button
Persistence:
- Calibration values stored in flow context variables
- Automatically saved to configuration files:
/home/pi/MinAz.cfg/home/pi/MaxAz.cfg/home/pi/MinEl.cfg/home/pi/MaxEl.cfg
Startup:
- Reads calibration files on initialization
- Debug nodes show loaded values
Configuration:
- Sliders set target Azimuth (0-360°) and Elevation (0-90°)
- Minimum move distance threshold (default: 4°)
- Auto-tracking enable/disable toggle
Tracking Logic:
- Runs every second via inject nodes
- Calculates angular difference between current and target positions
- If difference > threshold, initiates movement in correct direction
- Continues until within tolerance
- Automatically stops when target reached
Special Functions:
- "Park" button sets target to Az=180°, El=0°
- Auto-tracking disabled on timeout events
Hamlib/rotctld Emulation (TCP Port 4533):
- Accepts standard rotctl commands:
P <az> <el>- Set positionp- Get current positionM <az> <el>- Move to positionS- Stop movementq- Quit (triggers park)
- Returns positions in rotctl format
- Enable/disable via UI switch
GS-232 Serial Protocol:
- Listens on
/dev/ttyS0at 9600 baud - Accepts
Wcommands with azimuth/elevation - Responds to
Ccommands with current position - Compatible with Yaesu/GS-232 controllers
Rotation Time Monitoring:
- Azimuth timer: Stops if rotation >70 seconds
- Elevation timer: Stops if rotation >40 seconds
- Uses "hourglass" nodes for precise timing
Timeout Actions:
- Automatic stop of all movement
- Disable auto-tracking
- Send email and SMS alerts
- UI toast notification
- Status display updates
Alert Configuration:
- Email: (removed)
- SMS: (removed)
- Messages sent only once per timeout event
Dashboard Displays:
- Current Azimuth (compass gauge)
- Current Elevation (linear gauge)
- Target positions (text)
- Movement direction indicators
- Rotation timers (Azimuth and Elevation)
- Auto-tracking status
- Rotator power status (derived from sensor voltage)
- Tracking status (from external commands)
Debugging:
- Multiple debug nodes throughout the flow
- Can be enabled/disabled as needed
- Shows intermediate values and command parsing
-
Hardware Setup:
- Connect rotator motors to GPIO pins as specified
- Connect potentiometers to ADS1115 ADC
- Connect ADS1115 to Raspberry Pi I2C
-
Software Setup:
# Install Node-RED on Raspberry Pi bash <(curl -sL https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered) # Start Node-RED node-red-start # Import this flow # In Node-RED UI: Menu → Import → Paste JSON
-
Configuration:
- Ensure
/dev/ttyS0is available for serial communication - Configure email credentials in email nodes
- Calibrate the system before first use
- Ensure
- Use direction buttons to move the antenna
- Monitor position gauges in real-time
- Use "Stop" buttons to halt movement
- Enable "Allow Tracking" switch
- Set target positions using sliders
- System will automatically move to targets
- Use "Park" to return to home position
- Position at minimum limit, press "Set min"
- Position at maximum limit, press "Set max"
- Repeat for both azimuth and elevation
- Timeout Protection: Automatic stop after prolonged rotation
- Mutual Exclusion: Prevents simultaneous opposite directions
- Power Monitoring: Detects if rotator is powered off
- Alert System: Email/SMS notifications for issues
- Auto-Reset: Auto-tracking re-enabled every 10 minutes
- No Movement: Check GPIO wiring and pin assignments
- Inaccurate Position: Recalibrate the system
- Timeout Alerts: Verify rotation limits are reasonable
- Communication Issues: Check serial port permissions and baud rate
- Dashboard Not Loading: Ensure Node-RED is running and port 1880 is accessible
MIT License - feel free to use and modify for your satellite tracking needs.