Automatic Laser Gun

Automatic Laser Gun

Description

# Laser Gun - Esp Driver This Is The Driver Of Esp8266 For The Timed Laser Gun Project (Here The [Webinterface](Https://Github.Com/Enricoaleandri/Lasergun-Iot-Web)), A Remix Of [Remotely Controlled Torch Robot](Http://Www.Thingiverse.Com/Thing:1598813) By Jjrobots. Timed Laser Gun Project Is An Automatic Toy To Let You Cat Play With Laser Pointer. I Used An Esp To Control The Servo Motors And A Rtc To Provide A Correct Timing To Schedule The Events. ## Running On Esp Nodemcu To Programm The Esp, Use The [Arduino Ide](Https://Www.Arduino.Cc/En/Main/Software), Then Follow This Step : * Go On **File** > **Preferences**, And Change The Url Of Board Manager With "Http://Arduino.Esp8266.Com/Package_Esp8266Com_Index.Json", Then Click Ok * Now Go On **Tools** > **Board:Arduino One** > **Board Managers** * Search For "Esp8266" And Click Install ( It Will Take A While ) * After Installation Go Back On **Tools** > **Board:Arduino One** And Click On **"Nodemcu 0.9 (Esp-12E Module)"** * Now You Can Connect It And Lunch The Load Process ## Build Hardware The Hardware Part Is Made By : * X1 [Esp8266 Nodemcu](Https://Www.Amazon.It/Nodemcu-Internet-Delle-Esp8266-Scheda-Sviluppo/Dp/B019Pvi4Iy) * X2 [Servo Motor 9G](Https://Www.Amazon.It/Mini-Micro-Servo-Aerei-Elicotteri/Dp/B00Chjug3I) * X1 [Rtc](Https://Www.Amazon.It/Wingoneer-Piccolo-At24C32-Precisione-Orologio/Dp/B01H5Nafuy) I Used An Rtc, To Have A Real Timinig And Schedule The Event, But You Can Also Use A Virtual Rtc To Simulate The Timer ( Obviously It Will Not Be Precise Like Rtc But You Can Every Day Sync With A Remote Server And It Will Be Enough ). [Here The Class I Wrote](Https://Raw.Githubusercontent.Com/Enricoaleandri/Lasergun-Iot-Driver/Master/Example/Virtualrtc.Ino) And Here How To Use It : ``` Void Setup(){ //String Timenow = Yourcustomtimeservice.Getstringtime(); // This In Case You Have A Service That Provide This String Date Format Dd/Mm/Yyyy Hh:Mm:Ss String Timenow = "Dd/Mm/Yyyy Hh:Mm:Ss"; String D = Timenow.Substring(0,2); String H = Timenow.Substring(3,5); String M = Timenow.Substring(6,8); String S = Timenow.Substring(9,11); Rtc_Timer = Rtc(); Rtc_Timer.Setup(D.Toint(), H.Toint(),M.Toint(),S.Toint()); } Void Loop() { Rtc_Timer.Looptime(); Int Seconds = Rtc_Timer.Getseconds(); Int Minutes = Rtc_Timer.Getminutes(); Int Hours = Rtc_Timer.Gethours(); Int Days = Rtc_Timer.Getdays(); // Here You Will Use It } ``` I Removed The Soldered Pins Just To Save Space, But I Think You Can Do It Without Desoldering, Just Force A Little Bit. Use This ( I Not If Is Ugly I'M Not A Painter :D ) Datasheet To Build The Hardware, I Just Make A Simple List Of Connection Points: ##### Servo X * Gnd -> Gnd * Vcc -> Vcc ( +5 ) * Sign -> D6 ##### Servo Y * Gnd -> Gnd * Vcc -> Vcc ( +5 ) * Sign -> D5 ##### Rtc * Gnd -> Gnd * Vcc -> Vcc ( +3 ) * Sda -> D2 * Scl -> D1 ##### Battery (Do Not Plug Microusb And Connect Battery Simultaneously, I Didn'T Try But I Suggest To Do Not Try) * Positive -> Vcc ( +5 ) * Negative -> Gnd ##### Here The Datasheet ![Alt Tag](Https://Raw.Githubusercontent.Com/Enricoaleandri/Lasergun-Iot-Driver/Master/Build-Datasheet.Jpeg) ##### Here My Result ![Alt Tag](Https://Raw.Githubusercontent.Com/Enricoaleandri/Lasergun-Iot-Driver/Master/Build-Result.Jpeg) Then Put All In The Base Case, Use 2/3 Mm Screws ( I'M Not Sure ) To Fix The Esp To The Base, And That'S It, Program It And Enjoy It. ##### Use The Laser Gun For The Information About The Functionality Of Esp, Refer The [Webinterface](Https://Github.Com/Enricoaleandri/Lasergun-Iot-Web) Documentation

Statistics

Likes

37

Downloads

0