DEV Community

Cover image for Self-Aligning Satellite Dish in Rust: Pan Application
Ian Ndeda
Ian Ndeda

Posted on

Self-Aligning Satellite Dish in Rust: Pan Application

In this part we'll implement the relays we tested in the previous example in the project.

Table of contents

Requirements

  • 1 x Raspberry Pico board
  • 1 x USB Cable type 2.0
  • 1 x HC-05 Bluetooth module
  • 1 x HMC5833L Compass Module
  • 40 x M-M Jumper Wires
  • 2 x Mini Breadboards
  • 2 x SG90 Servo Motor
  • 1 x PTZ Kit
  • 1 x GPS Module
  • 2 x Relay modules
  • 2 x 4.2V Li-ion Batteries
  • 1 x DC-DC Step-down Converter
  • 1 x Diode

Implementation

Connections

relays-app-setup

❗ At this point the number of components used has grown so that the computer's USB port may not sufficiently provide power. An external power supply is therefore necessary. I used two 4.2V Li-ion 78000mAh batteries with a DC-DC converter.

Pan

Copy the pan function ,relay initialization pins and the sio handle under the loop's critical section from the previous example to the project.

Under the manual arm of the loop when the direction is selected as clockwise or counterclockwise we want to be able to pan appropriately.

For clockwise direction:

pan(&mut delay, sio.as_mut().unwrap(), Direction::Cw);
Enter fullscreen mode Exit fullscreen mode

For counterclockwise direction:

pan(&mut delay, sio.as_mut().unwrap(), Direction::Ccw);
Enter fullscreen mode Exit fullscreen mode

Results

This will be our updated code.

After flashing and running the program in the Pico, sending the CW command from the Bluetooth Terminal App should pan the PTZ kit clockwise and CCW counterclockwise.

relays-app-results

In the next part of the project we'll finalize on the logic of the application.

Top comments (0)