Cucumber the robot dog
[Spring 2025] What we did:We built Cucumber, a quadruped robot pet powered by the Raspberry Pi Pico W, designed to move, pose, follow people, and respond to user commands. It combines DC motors for locomotion, servos for expressive poses, ultrasonic sensors for autonomous following, an OLED display for visual feedback, and a speaker for synthesized dog sounds using DDS. A custom web interface hosted by the Pico W allows users to control movement, pose, sound, and mode over
- Suitable forB.Tech/B.E Embedded Systems students
- Build time4-6 weeks
- LevelBeginner
- Available atAjvika Labs, Kakinada
About this project
☰
Introduction
High-Level Design
Hardware
Software
Results
Conclusion
Work Distribution
Appendix
Reference
ECE 4760 Final Project
Cucumber in Downward Dog Pose
Introduction
Example poses displayed by Cucumber the robot dog
Pickles: the inspiration for Cucumber’s name
Cucumber is a Wi-Fi-controlled quadruped robot dog that follows you, poses on command, and barks and displays personality.
After all, who would not enjoy a pet that you do not need to feed? (Except you do need to put in new batteries every now and then.)
Summary
What we did:
We built Cucumber, a quadruped robot pet powered by the Raspberry Pi Pico W, designed to move, pose,
follow people, and respond to user commands. It combines DC motors for locomotion, servos for expressive poses, ultrasonic
sensors for autonomous following, an OLED display for visual feedback, and a speaker for synthesized dog sounds using DDS.
A custom web interface hosted by the Pico W allows users to control movement, pose, sound, and mode over Wi-Fi.
The entire system runs on dual-core concurrency with protothreads for smooth, real-time responsiveness.
Why we did it:
Our goal was to create a robot that felt more like a companion than just a machine—something expressive,
interactive, and fun. We wanted to apply microcontroller's concepts in a creative way that emphasized user engagement,
real-time control, and physical behavior. This project challenged us to balance hardware constraints, concurrency,
and usability, while giving us the opportunity to build a full-stack microcontroller system with personality.
High-Level Design
Figure: High level design of Cucumber in two modes
The dog is controlled via a webpage hosted by the Pico W. When in Manual Mode, the user can move the dog and give
it commands for physical poses and audio clips. When in Follow Mode, the dog will attempt to move towards the closest
object.
Rationale and Sources
Cucumber was inspired by a combination of quadruped robotics platforms like Boston Dynamics' Spot and the
designing robotic systems through the Raspberry Pi Pico W. We also drew inspiration from the Zoomer Robotic Dog Toy. Our goal was to create an expressive and
interactive robot dog that could emulate companionship and real-time responsiveness. The team drew upon
knowledge from embedded systems, control theory, and digital signal processing acquired in ECE 4760 and other courses.
Background Math
1. Pulse-Width Modulation (PWM) for Motor and Servo Control
Cucumber’s movement is controlled by:
DC motors for translational motion (forward/backward)
Servos for leg articulation and expressive poses
Both components are controlled via Pulse Width Modulation (PWM), which rapidly switches a digital pin between HIGH and LOW to approximate analog power delivery. The key variable is duty cycle:
$$\text{Duty Cycle (%)} = \left( \frac{T_{\text{ON}}}{T_{\text{ON}} + T_{\text{OFF}}} \right) \times 100$$
where \( T_{\text{ON}} \) is the time the signal is HIGH and \( T_{\text{OFF}} \) is the time it is LOW.
Figure: Servo PWM mapping from duty cycle to angle
For a standard 50 Hz signal (period = 20 ms), servos like the MG996R interpret:
1.0 ms pulse → 0°
1.5 ms pulse → 90°
2.0 ms pulse → 180°
So, to convert angle to pulse width:
$$\text{Pulse Width (ms)} = 1.0 + \left( \frac{\text{Angle}}{180} \right) \times 1.0$$
This is then mapped to a PWM count based on the system clock frequency \( f_{\text{clk}} \), clock divider \( D \), and wrap value:
$$\text{PWM Count} = \text{Pulse Width (s)} \times \frac{f_{\text{clk}}}{D}$$
For example, with a wrap value of 20,000 and divider of 125:
$$\text{Count}_{90^\circ} = 1.5 \times 10^{-3} \times \frac{125 \times 10^6}{10^3} = 1875$$
Each servo on Cucumber uses this math to translate leg poses into accurate angular control.
2. Ultrasonic Distance Measurement (HC-SR04)
Cucumber uses HC-SR04 ultrasonic sensors to measure distance to nearby objects. The sensor emits a pulse and measures the round-trip time \( t \). The formula for distance:
$$d = \frac{t \cdot v}{2}$$
where \( v \approx 343\, \text{m/s} \). In microcontroller units using microseconds:
$$d(\text{cm}) = \frac{t(\mu s)}{58}$$
This conversion is used to read two distances: from the left and right sensor. The control algorithm compares them to decide movement:
diff = left_distance - right_distance
if diff > threshold:
turn right
elif diff < -threshold:
turn left
else:
go forward
3. Direct Digital Synthesis (DDS) for Audio Barking/Growling
Cucumber uses DDS to synthesize audio (barks, growls, howls) by generating a digital waveform via a sine lookup table. Frequency of output signal is:
$$f_{\text{out}} = \frac{\Delta \cdot f_{\text{clk}}}{2^N}$$
where:
\( \Delta \): Phase increment
\( f_{\text{clk}} \): Sampling rate (e.g., 50 kHz)
\( N \): Number of bits in the phase accumulator (e.g., 32)
The output is:
phase_accum += phase_incr;
sample = sine_table[phase_accum >> 24];
To shape sound over time, we apply an amplitude envelope function:
\[
A(t) =
\begin{cases}
\frac{t}{T_{\text{attack}}} & \text{if } t < T_{\text{attack}} \\
1 & \text{if } T_{\text{attack}} \le t < T_{\text{attack}} + T_{\text{sustain}} \\
1 - \frac{t - (T_{\text{attack}} + T_{\text{sustain}})}{T_{\text{decay}}} & \text{otherwise}
\end{cases}
\]
This allows us to modulate the loudness of the audio in realistic bark/growl/howl patterns.
4. Wi-Fi Control & URL Parsing
Figure: Back and forth communication conducted between user device and RP2040 to connect and use the wireless access point
At a high level, sending Wi-Fi signals involves converting digital data into radio waves that can
travel wirelessly and be received by other devices. The Pico W uses an CYW43439 chip to
handle conversion of data into a 2.4 GHz radio wave that can be detected and connected to by
other devices. From there, network communication is conducted using Transmission Control
Protocol (TCP). Once verified, the user sends an HTTP GET request in the form of the URL.
This is passed to the RP2040 which parses the data from the request, makes necessary variable
updates, and sends the HTML data for the corresponding page. The user device and RP2040 will
continue to send and receive GET requests and responses until the connection is closed.
Logical Structure
Figure: High level breakdown of what code is on each core
Cucumber uses a dual-core approach on the Raspberry Pi Pico W:
Core 0:
Hosts the TCP web server, processes input requests
Core 1:
Handles all actuation logic—motors, servos, and sensors
The system uses protothreads for cooperative multitasking, enabling servo sweeps, sound generation, and sensor reads in parallel without true preemption.
Hardware/Software Tradeoffs
Our DC motor system operated without encoders, making it an open-loop system. This limited our ability to
achieve precise forward motion, as we couldn't track or correct for differences in wheel rotation. We made
the decision to not complicate our hardware further and accept this imprecision in motor movement in manual
mode. We relied on software to process data from the ultrasonic sensors and dynamically adjust motor power
during follow mode. While adding encoders would have improved precision, it would have introduced additional
hardware complexity and GPIO requirements, so we chose to keep the system simple and manage direction purely through feedback.
When implementing audio, we explored several options for generating sound. Initially,
we considered processing a pre-recorded sound bit and passing it directly to the speakers.
However, we chose to use Direct Digital Synthesis (DDS) along with a DAC which offloaded the
signal conversion from the software to the hardware. One issue we encountered was low speaker
volume. We opted for a hardware fix by adding an amplifier rather than complicating the
software signal further.
At the beginning of the project, we considered adding a potentiometer and button for user
control alongside the web interface. This control scheme would have been very similar to Lab 2,
with the OLED displaying options, the potentiometer being used to move between them, and the
button being used to select. However, this idea became impractical for several reasons. First, any
robot movement during motor operation would physically shift the controls away from the user,
reducing usability. Second, we used all available GPIOs on the board, leaving no room for the
ADC or button. Most importantly, the web interface was implemented more quickly and
effectively than anticipated, rendering the physical controls unnecessary. As a result, we relied
fully on software via the Wi-Fi access point for all user control.
Hardware Design
Preliminary Mechanical Design
Figure: Preliminary robot dog design
The preliminary design for Cucumber illustrated in the image above. Cucumber can move back and forth using motor wheels, perform different poses using a positional servo on each leg joint, detect and interact with users using ultrasonic sensors, and interact using a speaker, OLED screens, and buttons. Instead of having two joints per leg like a real dog, we opted for one joint and a DC motor wheel to take care of locomotion. This simplifies movement for the robot dog and makes the project more realistic given the 4-week time constraint.
CAD Design
Figure: Original CAD Design
Figure: Modified CAD Design
The mechanical CAD design of Cucumber the robot dog is primarily based off of an existing design for
Goodboy
, an Ardui
Introduction
High-Level Design
Hardware
Software
Results
Conclusion
Work Distribution
Appendix
Reference
ECE 4760 Final Project
Cucumber in Downward Dog Pose
Introduction
Example poses displayed by Cucumber the robot dog
Pickles: the inspiration for Cucumber’s name
Cucumber is a Wi-Fi-controlled quadruped robot dog that follows you, poses on command, and barks and displays personality.
After all, who would not enjoy a pet that you do not need to feed? (Except you do need to put in new batteries every now and then.)
Summary
What we did:
We built Cucumber, a quadruped robot pet powered by the Raspberry Pi Pico W, designed to move, pose,
follow people, and respond to user commands. It combines DC motors for locomotion, servos for expressive poses, ultrasonic
sensors for autonomous following, an OLED display for visual feedback, and a speaker for synthesized dog sounds using DDS.
A custom web interface hosted by the Pico W allows users to control movement, pose, sound, and mode over Wi-Fi.
The entire system runs on dual-core concurrency with protothreads for smooth, real-time responsiveness.
Why we did it:
Our goal was to create a robot that felt more like a companion than just a machine—something expressive,
interactive, and fun. We wanted to apply microcontroller's concepts in a creative way that emphasized user engagement,
real-time control, and physical behavior. This project challenged us to balance hardware constraints, concurrency,
and usability, while giving us the opportunity to build a full-stack microcontroller system with personality.
High-Level Design
Figure: High level design of Cucumber in two modes
The dog is controlled via a webpage hosted by the Pico W. When in Manual Mode, the user can move the dog and give
it commands for physical poses and audio clips. When in Follow Mode, the dog will attempt to move towards the closest
object.
Rationale and Sources
Cucumber was inspired by a combination of quadruped robotics platforms like Boston Dynamics' Spot and the
designing robotic systems through the Raspberry Pi Pico W. We also drew inspiration from the Zoomer Robotic Dog Toy. Our goal was to create an expressive and
interactive robot dog that could emulate companionship and real-time responsiveness. The team drew upon
knowledge from embedded systems, control theory, and digital signal processing acquired in ECE 4760 and other courses.
Background Math
1. Pulse-Width Modulation (PWM) for Motor and Servo Control
Cucumber’s movement is controlled by:
DC motors for translational motion (forward/backward)
Servos for leg articulation and expressive poses
Both components are controlled via Pulse Width Modulation (PWM), which rapidly switches a digital pin between HIGH and LOW to approximate analog power delivery. The key variable is duty cycle:
$$\text{Duty Cycle (%)} = \left( \frac{T_{\text{ON}}}{T_{\text{ON}} + T_{\text{OFF}}} \right) \times 100$$
where \( T_{\text{ON}} \) is the time the signal is HIGH and \( T_{\text{OFF}} \) is the time it is LOW.
Figure: Servo PWM mapping from duty cycle to angle
For a standard 50 Hz signal (period = 20 ms), servos like the MG996R interpret:
1.0 ms pulse → 0°
1.5 ms pulse → 90°
2.0 ms pulse → 180°
So, to convert angle to pulse width:
$$\text{Pulse Width (ms)} = 1.0 + \left( \frac{\text{Angle}}{180} \right) \times 1.0$$
This is then mapped to a PWM count based on the system clock frequency \( f_{\text{clk}} \), clock divider \( D \), and wrap value:
$$\text{PWM Count} = \text{Pulse Width (s)} \times \frac{f_{\text{clk}}}{D}$$
For example, with a wrap value of 20,000 and divider of 125:
$$\text{Count}_{90^\circ} = 1.5 \times 10^{-3} \times \frac{125 \times 10^6}{10^3} = 1875$$
Each servo on Cucumber uses this math to translate leg poses into accurate angular control.
2. Ultrasonic Distance Measurement (HC-SR04)
Cucumber uses HC-SR04 ultrasonic sensors to measure distance to nearby objects. The sensor emits a pulse and measures the round-trip time \( t \). The formula for distance:
$$d = \frac{t \cdot v}{2}$$
where \( v \approx 343\, \text{m/s} \). In microcontroller units using microseconds:
$$d(\text{cm}) = \frac{t(\mu s)}{58}$$
This conversion is used to read two distances: from the left and right sensor. The control algorithm compares them to decide movement:
diff = left_distance - right_distance
if diff > threshold:
turn right
elif diff < -threshold:
turn left
else:
go forward
3. Direct Digital Synthesis (DDS) for Audio Barking/Growling
Cucumber uses DDS to synthesize audio (barks, growls, howls) by generating a digital waveform via a sine lookup table. Frequency of output signal is:
$$f_{\text{out}} = \frac{\Delta \cdot f_{\text{clk}}}{2^N}$$
where:
\( \Delta \): Phase increment
\( f_{\text{clk}} \): Sampling rate (e.g., 50 kHz)
\( N \): Number of bits in the phase accumulator (e.g., 32)
The output is:
phase_accum += phase_incr;
sample = sine_table[phase_accum >> 24];
To shape sound over time, we apply an amplitude envelope function:
\[
A(t) =
\begin{cases}
\frac{t}{T_{\text{attack}}} & \text{if } t < T_{\text{attack}} \\
1 & \text{if } T_{\text{attack}} \le t < T_{\text{attack}} + T_{\text{sustain}} \\
1 - \frac{t - (T_{\text{attack}} + T_{\text{sustain}})}{T_{\text{decay}}} & \text{otherwise}
\end{cases}
\]
This allows us to modulate the loudness of the audio in realistic bark/growl/howl patterns.
4. Wi-Fi Control & URL Parsing
Figure: Back and forth communication conducted between user device and RP2040 to connect and use the wireless access point
At a high level, sending Wi-Fi signals involves converting digital data into radio waves that can
travel wirelessly and be received by other devices. The Pico W uses an CYW43439 chip to
handle conversion of data into a 2.4 GHz radio wave that can be detected and connected to by
other devices. From there, network communication is conducted using Transmission Control
Protocol (TCP). Once verified, the user sends an HTTP GET request in the form of the URL.
This is passed to the RP2040 which parses the data from the request, makes necessary variable
updates, and sends the HTML data for the corresponding page. The user device and RP2040 will
continue to send and receive GET requests and responses until the connection is closed.
Logical Structure
Figure: High level breakdown of what code is on each core
Cucumber uses a dual-core approach on the Raspberry Pi Pico W:
Core 0:
Hosts the TCP web server, processes input requests
Core 1:
Handles all actuation logic—motors, servos, and sensors
The system uses protothreads for cooperative multitasking, enabling servo sweeps, sound generation, and sensor reads in parallel without true preemption.
Hardware/Software Tradeoffs
Our DC motor system operated without encoders, making it an open-loop system. This limited our ability to
achieve precise forward motion, as we couldn't track or correct for differences in wheel rotation. We made
the decision to not complicate our hardware further and accept this imprecision in motor movement in manual
mode. We relied on software to process data from the ultrasonic sensors and dynamically adjust motor power
during follow mode. While adding encoders would have improved precision, it would have introduced additional
hardware complexity and GPIO requirements, so we chose to keep the system simple and manage direction purely through feedback.
When implementing audio, we explored several options for generating sound. Initially,
we considered processing a pre-recorded sound bit and passing it directly to the speakers.
However, we chose to use Direct Digital Synthesis (DDS) along with a DAC which offloaded the
signal conversion from the software to the hardware. One issue we encountered was low speaker
volume. We opted for a hardware fix by adding an amplifier rather than complicating the
software signal further.
At the beginning of the project, we considered adding a potentiometer and button for user
control alongside the web interface. This control scheme would have been very similar to Lab 2,
with the OLED displaying options, the potentiometer being used to move between them, and the
button being used to select. However, this idea became impractical for several reasons. First, any
robot movement during motor operation would physically shift the controls away from the user,
reducing usability. Second, we used all available GPIOs on the board, leaving no room for the
ADC or button. Most importantly, the web interface was implemented more quickly and
effectively than anticipated, rendering the physical controls unnecessary. As a result, we relied
fully on software via the Wi-Fi access point for all user control.
Hardware Design
Preliminary Mechanical Design
Figure: Preliminary robot dog design
The preliminary design for Cucumber illustrated in the image above. Cucumber can move back and forth using motor wheels, perform different poses using a positional servo on each leg joint, detect and interact with users using ultrasonic sensors, and interact using a speaker, OLED screens, and buttons. Instead of having two joints per leg like a real dog, we opted for one joint and a DC motor wheel to take care of locomotion. This simplifies movement for the robot dog and makes the project more realistic given the 4-week time constraint.
CAD Design
Figure: Original CAD Design
Figure: Modified CAD Design
The mechanical CAD design of Cucumber the robot dog is primarily based off of an existing design for
Goodboy
, an Ardui
Technologies used
Hardware components
- RP2040
- Raspberry Pi Pico
- OLED display
- DC motor
- ultrasonic sensor
- speaker
- amplifier
- DAC
- ADC
Software & tools
- C
- Arduino IDE
Project demo video
What you get
- Working project / hardware kit, tested before delivery
- Complete source code with explanation
- Project demo and guidance for your viva
- Project report, PPT and IEEE paper support (on request)
Delivery & Payment
Delivery takes a minimum of two weeks from the date your inquiry is confirmed.
Payment is in two parts:
• 50% advance to start the project
• Remaining 50% before delivery
Note:
• Documentation and PPT are not included by default
• If you need documentation/PPT, it can be arranged for extra time and cost
We'll confirm the exact timeline and cost with you after reviewing your requirements.