Skip to content

guttih/laserPointer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

laserPointer

This project will be about driving 2 servos and 1 laser using a esp32 and a power supply to to point to parts or tools, I own around my garage. This project will be connected to another project called GParts which is also located on this github space.

Wiring

How to connect a 6V laser to esp32 and and be able to control it's brightness

  • BC337 Base (middle pin) to ESP32 D4
  • BC337 Collector to GND
  • BC337 Emitter to Laser GND
  • Laser VCC wire to 6V

Parts used in the project

Wiring diagram

GND                                      +6V
 ├──────────────────────┐                 │
 |        ╔═══════════╗ |                 │
 |        ║  -BC337-  ║ |    ╔═════════╗  |
 |        ║           ║ |    ║ -Laser- ║  │
 |        ║ Collector ╟─┘    ║         ║  │
 |  ┌─────╢ Base      ║      ║     VCC ╟──┤
 |  │     ║ Emitter   ╟──────╢ GND     ║  │
 |  │     ╚═══════════╝      ╚═════════╝  │
 |  │     ╔═══════════╗     ╔══════════╗  │
 │  │     ║  -ESP32-  ║     ║-HLK-PM01-║  │
 |  │     ║           ║     ║          ║  │
 │  │ GND ║ 3V3   VIN ╟─────╢ +Vo (+5V)║  │
 │  │  ╧ ─╢ GND   GND ╟─────╢ -Vo      ║  │
 │  └─────╢ D4        ║     ╚══════════╝  │
 |      ┌─╢ D13   D12 ╟─┐ ┌───── GND      │
 |      │ ║           ║ | |       ╧       │
 |      │ ╚═══════════╝ | | ╔══════════╗  │
 |      │ ╔══════════╗  | | ║ -Servo2- ║  │
 |      │ ║ -Servo1- ║  | | ║          ║  │
 |      │ ║          ║  | └─╢ GND      ║  │
 |      └─╢ Signal   ║  └───╢ Signal   ║  │
 |        ║      VCC ╟──┐   ║      VCC ╟──┤
 └────────╢ GND      ║  |   ╚══════════╝  │
          ╚══════════╝  └─────────────────┘

Breadboard drawing

Wiring on a breadboard The image is based on this document which was drawn in fritzing.


Available http commands

In examples let's assume the esp32 has been issued the ip address 192.168.1.231 on your local network.

Move

Method: HTTP GET.

Move accepts four query parameters

  • tilt is a Required parameter for how much in degrees the tower should be tilted (up/down position).
    • Valid values: 0 - 264.
  • pan is a Required parameter for how much in degrees the tower should be paned (left/right position).
    • Valid values: 0 - 255
  • laser is a Optional parameter for how bright the laser should be where 255 is full on and 0 if off.
    • Valid values: 0 - 255
  • blink is a Optional parameter how many milliseconds should pass before blinking. Pass 0 to turn blinking off. Pass 3500 to make the laser blink every 3.5 seconds.
    • Valid values: 0 - 2147483647

Example query

  • http://192.168.1.231:5100/move?tilt=101&pan=148&laser=255&blink=1000

Set

Method: HTTP GET.

Set accepts two query parameters

  • laser is a Optional parameter for how bright the laser should be where 255 is full on and 0 if off.
    • Valid values: 0 - 255
  • blink is a Optional parameter how many milliseconds should pass before blinking. Pass 0 to turn blinking off. Pass 3500 to make the laser blink every 3.5 seconds.
    • Valid values: 0 - 2147483647

Example query

  • http://192.168.1.231:5100/set?laser=255&blink=3000

Grid

Method: HTTP GET.

Grid accepts two query parameters

  • tilt is a Required parameter for how much in degrees the tower should be tilted (up/down position).
    • Valid values: 0 - 264.
  • pan is a Required parameter for how much in degrees the tower should be paned (left/right position).
    • Valid values: 0 - 255

Example query

  • http://192.168.1.231:5100/grid?tilt=70&pan=90

Development

To upload this program firmware over the air (OTA) change the upload-port to 3232. To upload this program firmware using usb change the upload-port to something like COM6, that is if you computer gave the esp32 usb connection the name COM6.


About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published