motion detection and tracking for the esp32-cam water gun

  Рет қаралды 12,334

Jonathan R

Jonathan R

Күн бұрын

I've added motion tracking and detection to the esp32-cam electric water gun that I made in the last video. Hopefully, it will now automatically detect when pigeons have landed on the balcony and spray them with water.
Details of how I made the water gun are here:
• esp32 cam remote contr...
The code I used is here:
github.com/jon...
Maker Mashup's video on motion tracking, which was very useful for this project:
• ESP32-CAM as a Directi...
Random nerd tutorial on pan-tilt mechanism for the esp32-cam
randomnerdtuto...

Пікірлер: 79
@MaxImagination
@MaxImagination 12 күн бұрын
Thank you for the video, Jonathan. The SOLUTION to making the SERVOs work (for anyone facing a similar issue) is to allocate two timers in the code. Add these two lines in the setup() function above where servos are attached: ESP32PWM::allocateTimer(2); ESP32PWM::allocateTimer(3); Hope this helps!
@jonathanr4242
@jonathanr4242 12 күн бұрын
Thanks. That is very helpful.
@stevenm3914
@stevenm3914 Жыл бұрын
Very interesting little project. Dispite how silly it is there is a lot of time spent researching. Gota hand it to you, hope to see more from you soon on another random youtube suggestion.
@jonathanr4242
@jonathanr4242 Жыл бұрын
Thanks. I appreciate the comment.
@YATESA8
@YATESA8 Жыл бұрын
KZbin suggested this video to me for some reason. I hope more people get to see this one. I like the project!
@jonathanr4242
@jonathanr4242 Жыл бұрын
Thank you!
@jeditor8960
@jeditor8960 11 ай бұрын
Schon viel Gelernt, danke! A6400
@andrew_bookallil
@andrew_bookallil Жыл бұрын
That’s awesome Jonny! Copy-write that asap bro! Great work!👍🤜🤛
@jonathanr4242
@jonathanr4242 Жыл бұрын
Thanks Andrew. That’s a big compliment.
@michaelomode630
@michaelomode630 Жыл бұрын
Thank you for sharing your work!
@jonathanr4242
@jonathanr4242 Жыл бұрын
Thank you, for your kind words. I really hope to inspire people to be creative.
@saarboaz123
@saarboaz123 6 ай бұрын
You are a true genius
@jonathanr4242
@jonathanr4242 6 ай бұрын
Thank you, Saar. That is very kind.
@orlandop2265
@orlandop2265 Жыл бұрын
i was waiting for this, great project!!
@jonathanr4242
@jonathanr4242 Жыл бұрын
Thank you!
@Ryanpeka
@Ryanpeka 2 күн бұрын
Thanx for your video ,is there any way i can get it to track and keep the top of the moving object in the centre of the frame (UP AND DOWN)
@jonathanr4242
@jonathanr4242 2 күн бұрын
@@Ryanpeka hi. I haven’t tried that, but I don’t see that there would be an issue with just swapping the x and y coordinates, especially since the camera is mounted on a pan-tilt mechanism.
@danh9002
@danh9002 9 ай бұрын
Great video! Thank you!
@jonathanr4242
@jonathanr4242 9 ай бұрын
Thank you, for the kind words.
@H0mework
@H0mework Жыл бұрын
Are you sure they’ll dislike the water or that it’ll be strong enough pressure? Pidgeons hate spikes, might want to automate spike deployment or just cover your balcony with them. Maybe a motion detector to deploy a buzzer or noise?
@jonathanr4242
@jonathanr4242 Жыл бұрын
I did a buzzer in a previous project but the sound annoyed my wife
@SeniorDonCarlo
@SeniorDonCarlo 4 ай бұрын
Thank you for sharing your project! It seems you only can go to the left or right, but not up or down right? Would it be the same code to add that functionality ?
@jonathanr4242
@jonathanr4242 4 ай бұрын
Yes. It would not be that difficult to add the up/down functionality. I just didn't do it because I didn't need it.
@lezbriddon
@lezbriddon Жыл бұрын
well 10 month to Halloween but I'm thinking scary pumpkin head that turns and follows you as you walk up the path...
@jonathanr4242
@jonathanr4242 Жыл бұрын
That would be cool… with red LEDs for eyes.
@lezbriddon
@lezbriddon Жыл бұрын
@@jonathanr4242 second thought. A car chassis with a plastic monster on top, left/right servo signal could steer the car, and also trigger say 2 seconds of slow forward motion, so it crawls towards anyone who moves......
@surojitdas4496
@surojitdas4496 11 ай бұрын
Can I get the required libraries?
@engineergaming275
@engineergaming275 10 ай бұрын
Very cool turret! Is it possible to make the turret track without connecting to wifi? I also have a problem with servomotors, they just don't seem to react, although everything is connected correctly and the servos work with a different code
@Rangan-vaathiyar
@Rangan-vaathiyar Жыл бұрын
sir what board select this project AI THINKER or WROVER BOARD
@jonathanr4242
@jonathanr4242 Жыл бұрын
AI THINKER.
@Rangan-vaathiyar
@Rangan-vaathiyar Жыл бұрын
@@jonathanr4242 thank you sir it's work but Up Down Servo motor is not work sir what i doing next
@jonathanr4242
@jonathanr4242 Жыл бұрын
@@Rangan-vaathiyar You need to try and test the up-down servo is working properly. see if you can isolate the problem.
@Graemecns
@Graemecns 2 ай бұрын
Hi Jonathan Great Video Great Project. Just what I was searching for. I am trying to build a sentinel turret with a gelblaster. In have cut back the firing time ok But due to physical constraints (usb tethered testing) I have mounted my ESP32 CAM upside down. Picture is the right way up Now of course the servo are all reversed and tracking in the wrong directions. In there a simple way to correct this in the code.
@jonathanr4242
@jonathanr4242 2 ай бұрын
@@Graemecns hi. Sorry, I’m not sure I understand. Are you using vflip?
@Graemecns
@Graemecns 2 ай бұрын
@@jonathanr4242 No I have had to mount my esp32 cam with the camera at the bottom (usb cable fouling) the video is streaming to WIFI right way up but the buttons were swapped Right Button moved the servo Left. I have fixed that in the HTML code. But in the tracking code if something comes in from the right the camera moves Left. opposite to the movement direction. Is there a simple fix? I have tried changing a number of parameters but no luck. also Does the tracking work for up and down
@Graemecns
@Graemecns 2 ай бұрын
@@jonathanr4242 no I have had to mount my ESP32 Upside down with the camera at the bottom. The video stream via wifi is the correct way up but the buttons were working in reverse. I have fixed the stream in the HTML Code the the buttons work the right diredtion, But the tracking software is reversed the camera sees the movement to the right but servo moves left.etc for directions. also does tracking up down work?
@jonathanr4242
@jonathanr4242 2 ай бұрын
@@Graemecns up/down is not implemented yet. You can try renaming the move_left function to move_right and vice versa, for a quick fix.
@Graemecns
@Graemecns 2 ай бұрын
I thought I tried that but I will try harder thanks
@wagnerfontes2
@wagnerfontes2 Жыл бұрын
Quite interesting! What do you think is the slowest step in the process? I would like to make it move faster...
@jonathanr4242
@jonathanr4242 Жыл бұрын
Probably moving the servos, because I don't want to mistake the motion of the servo, with the camera mounted on it, for general motion. You could probably speed it up a bit by taking the esp32-cam off the servo, and just leaving the watergun attached.
@Vellz08
@Vellz08 11 ай бұрын
excuse me sir, can i have the wiring diagram sir, because on mine, the servo are not function
@tree-service
@tree-service 7 ай бұрын
can this be done only with a black and white image, or will it work with a color one too?
@jonathanr4242
@jonathanr4242 7 ай бұрын
The algorithm requires grey level image data. In colour it would use more memory and be much slower so probably wouldn’t work on an esp32 AI thinker in real time. You have to use uncompressed images because the algorithm compares the raw pixel data between two images. You could probably use colour on a raspberry pi.
@tree-service
@tree-service 7 ай бұрын
@@jonathanr4242 i thing use 2 esp32 cam, first for detecting movements in grayscale, second -for taking color picture
@jonathanr4242
@jonathanr4242 7 ай бұрын
@@tree-service that would work nicely.
@opiritetariah
@opiritetariah Жыл бұрын
Awesome work, I tried it but kept on getting Jpeg compression failed. Please how can i fix this
@jonathanr4242
@jonathanr4242 Жыл бұрын
I'm not sure why this would happen. Try just doing the jpeg without all the other stuff.
@Botir-vo1xg
@Botir-vo1xg 9 ай бұрын
Good job bro, thanks a lot👍
@jonathanr4242
@jonathanr4242 9 ай бұрын
Thank you.
@botnumbers4703
@botnumbers4703 Жыл бұрын
When I tried it, the camera worked but the servos didn't move, even when I pressed the track button. How do I fix this?
@jonathanr4242
@jonathanr4242 Жыл бұрын
This could be due to a number of things. To troubleshoot I would place a serial.print in the move servo function to make sure it is being called. If it’s being called, just try moving the servo back and forth for a few seconds in the setup routine.
@botnumbers4703
@botnumbers4703 Жыл бұрын
@@jonathanr4242 Thank you! I will try this later
@botnumbers4703
@botnumbers4703 Жыл бұрын
@@jonathanr4242 How should I make the servos move? I'm a beginner so I don't really know :(
@jonathanr4242
@jonathanr4242 Жыл бұрын
@@botnumbers4703 Hi. Are you using the code that I wrote? The first thing is to make sure the servos are properly connected and responding. I would just put a loop at the end of the setup routine to test this. Something like //repeat this a couple of times for ( int i = 5; i 0;i =i -5){ Servo2.write(i); delay(100); } Note: Trouble shooting servos can be a bit tricky but it’s also very rewarding. Also, the code I got is based on random nerd tutorials code, with some lines added for tracking and firing the water gun. It might be worth seeing if you can get the servos working with their code. One thing I should point out is to make sure you have servoN1 and servoN2 defined, because these are dummy servos that are used to get the correct pwm channel.
@botnumbers4703
@botnumbers4703 Жыл бұрын
@@jonathanr4242 When I used added in your servo test code, it said "expected ; before i", how do I fix this?
@teknisyankuno2375
@teknisyankuno2375 Жыл бұрын
I need this for my cats :D
@adrianmaglaquee
@adrianmaglaquee Жыл бұрын
imagine having this when robbers tries to hide behind camera
@jonathanr4242
@jonathanr4242 Жыл бұрын
🤣😆
@charlesryan6868
@charlesryan6868 Жыл бұрын
I can not find where to select camera. I keep getting camera not selected error
@jonathanr4242
@jonathanr4242 Жыл бұрын
Are you using an esp32 ai thinker?
@charlesryan6868
@charlesryan6868 Жыл бұрын
yes and i found it. the tracking works but I can not get the servos to respond@@jonathanr4242
@jeffkellner7416
@jeffkellner7416 10 ай бұрын
Your program, project is amazing You have given us soo much but can i ask for some assistance i have another esp project that uses this command" client.print(status2);" its simply a text variable that i post on the page Ive tried but i cannot get it or other commands to work with your webpage Simply put i am trying to display your array motionview on the web page I am trying to add a couple lines of code to turn your project into a person coming up my driveway sensor my intention is to add a few check loops to follow the region of change. Thank you very much either way
@jonathanr4242
@jonathanr4242 10 ай бұрын
I'm not sure. It's been a while since I looked at it. You might need to convert to c_str()?
@samsongenet7762
@samsongenet7762 Жыл бұрын
Cool!! I made a similar project. But my servos do not respond.. Does anyone has the same problem?
@jonathanr4242
@jonathanr4242 Жыл бұрын
I needed to power the servos from a different source to the esp32, but with common ground
@JamilKhan-hk1wl
@JamilKhan-hk1wl Жыл бұрын
Maybe use something like raspberry pi zero for more computing power?
@jonathanr4242
@jonathanr4242 Жыл бұрын
Hi Jamil. Yes. I agree. They are more powerful, but also a bit more expensive at the moment. I would definitely like to try one for an image processing project.
@tree-service
@tree-service 7 ай бұрын
you have voice like Clivlend from Griffins
@ThaigersDen
@ThaigersDen 7 ай бұрын
I have been looking for a channel like this for a long time. Please get ahold of me.
@jonathanr4242
@jonathanr4242 6 ай бұрын
Thanks for your comment. Best to email me if you have a specific question.
@ThaigersDen
@ThaigersDen 6 ай бұрын
@@jonathanr4242 I’m on my cell phone and not sure how to access your email address from here. What is it?
@rubydan7483
@rubydan7483 Жыл бұрын
Need more water pressure Jonny😂
@jonathanr4242
@jonathanr4242 Жыл бұрын
Yes. People on FB have suggested a plasma ray, a laser, a taser, and someone ver admirably suggested a gerni.
@OMNI_INFINITY
@OMNI_INFINITY 2 ай бұрын
Thanks for posting code! Looks useful for making bj bot always face the correct….area.
@chenzora2417
@chenzora2417 Жыл бұрын
Hi, I have been following you. You do a great work. I work for NextPCB. We would like to sponsor your projects. You can send a DM for more details.
@jonathanr4242
@jonathanr4242 Жыл бұрын
Thank you. I am very flattered that you like the content. Please email me on the email address at the about tab.
esp32 to LLM and back again
16:45
Jonathan R
Рет қаралды 687
Instant Karma Caught on Camera. Best Moments of 2023
1:00:07
WOW TV
Рет қаралды 7 МЛН
DID A VAMPIRE BECOME A DOG FOR A HUMAN? 😳😳😳
00:56
Mom had to stand up for the whole family!❤️😍😁
00:39
Human vs Jet Engine
00:19
MrBeast
Рет қаралды 93 МЛН
Face Tracking Turret made with Arduino and Open CV2
2:36
Owen O'Brien
Рет қаралды 24 М.
Battle of the esp32 cams: XIAO esp32s3 Vs. AI Thinker
3:32
Jonathan R
Рет қаралды 7 М.
How to do Object Detection using ESP32-CAM and Edge Impulse YOLO Model
16:50
Object Detection & Identification using ESP32 CAM Module & OpenCV
7:05
How To Electronics
Рет қаралды 288 М.
Cambot! Servo controlled motion tracking camera.
6:38
ArtsyEngineering
Рет қаралды 48 М.
The coolest robot I've ever built!
19:40
Thomas Burns
Рет қаралды 4,8 МЛН
Sign Language Recognition with esp32-cam using tflite
36:47
Jonathan R
Рет қаралды 4,9 М.
DID A VAMPIRE BECOME A DOG FOR A HUMAN? 😳😳😳
00:56