

# hit with stick robot  

Can I build an interesting robot below 10€, that could be a prototype for robotics competition?

Robot will scan for targets in 180 degrees arc, and will try to hit targets that are not too close or too far.

Lot of room for improvements, but good enough for proof of concept.

Photos and video: [hit-with-stick-photos.md](hit-with-stick-photos.md)


## Required components

- nodemcu/arduino
- breadboard
- 2x servo (SG90)
- Ultrasonic Distance Sensor (HC-SR04)
- 3x 1kOhm resistors
- ~20 wires
- couple of sticks for arms
- some way to attach everything together

Total cost ~15€ .

## Steps

1. Get components.
2. Download arduino IDE.
3. Connect and test a simple program with blinking light.
4. Assemble components according to the diagram below.
5. Connect to the computer and upload program.
    1. https://git.makerobots.eu/konstantin/arduino-robots/src/branch/main/src/2026-06-18_hit-with-stick/2026-06-18_hit-with-stick.ino .
6. Iterate and find distances and delays that work for your setup.
    1. Min 10cm, max 20cm for detection.
    2. Offset if hitting stick is not centered.
    3. How fast could you make it without missing targets or hitting ones that are too close?



## wiring diagram

```
    5V Power Bank
    +         -
    |         |
    |         +-------------------- GND ------------------+
    |                                                    |
    |                                                    |
    +----+-------------------+----------------+           |
         |                   |                |           |
      Servo 1             Servo 2         NodeMCU VIN     |
      Red wire            Red wire            (5V in)     |
         |                   |                |           |
         |                   |                |           |
     Signal D5          Signal D6            GND ---------+
                                         
    HC-SR04
    VCC ---------------------- 5V
    GND ---------------------- GND
    TRIG --------------------- D1
    ECHO -- voltage divider -- D2
    
HC-SR04 Echo
      |
     1kΩ
      |
      +----> NodeMCU D2
      |
     2kΩ
      |
     GND    
```




    
