{"id":161,"date":"2019-02-23T17:32:47","date_gmt":"2019-02-23T17:32:47","guid":{"rendered":"http:\/\/pi.peernix.com\/?p=161"},"modified":"2019-02-23T17:32:47","modified_gmt":"2019-02-23T17:32:47","slug":"arduino-based-car-alarm-with-accelerometer","status":"publish","type":"post","link":"http:\/\/peernix.com\/?p=161","title":{"rendered":"Arduino based Car Alarm with Accelerometer"},"content":{"rendered":"\n<p>\nInspiration for a car alarm, what could that be? Around the beginning\nof 2018, I came into the prospect of buying a 2006 Jeep Liberty. I\nhad been happily driving my 1998 Toyota Camry for years prior, and\nhadn\u2019t really thought about acquiring another vehicle, but\nsomething about 4WD, and driving a big powerful vehicle seemed\nintriguing. I decided to go for it, as the price seemed about right.\nHowever, I didn\u2019t know what I was in for. It seems that these\nvehicles are sought after by thieves; something I would become well\naware of in the near future. \n<\/p>\n\n\n\n<p>\nI think almost immediately after buying the Jeep, the rear vent\nwindow was broken out. I decided I should buy a \u201cClub\u201d, or\npossibly the thought occurred to me to buy the club before it the\nwindow was broken; in any case, I had not purchased the club, and the\nwindow was broken. This led to me buying the club, which dissuaded\nfurther break-ins for a little while; this was until I forgot to put\nthe Club onto the steering wheel one day, boom, another vent window\nbroken. If there\u2019s something that irritates me, it\u2019s breaking my\nproperty, and trying to then steal it. But I digress, now that the\nmotivation of the Alarm should be clear, let\u2019s get back to making\nit!<\/p>\n\n\n\n<a href=\"https:\/\/imgbb.com\/\"><img decoding=\"async\" src=\"https:\/\/i.ibb.co\/MZPRKtg\/Screenshot-2019-02-23-11-03-50.png\" alt=\"Screenshot-2019-02-23-11-03-50\" border=\"0\"><\/a>\n\n\n\n<p>\nBack just prior to all of these break-ins, the Radio Shacks in the\narea were going out of business, and they were practically giving\naway everything in the store. So, needless to say, whenever there was\na closing, I was there, raiding the inventory. Among the inventory,\nthere were some Accelerators that before the closing of the store,\nwere going for something like $40, but were now on sale for a\nfraction of that, or just a few dollars; I do not remember anymore\nthe precise amount. Without a clear use in mind, I decided to buy one\nanyway. Now, thinking about what I could use to create a car alarm,\nan accelerator seemed like a great piece of hardware. Someone\nmanhandling the vehicle would surely create some movement that would\nbe detectable.<\/p>\n\n\n\n<a href=\"https:\/\/imgbb.com\/\"><img decoding=\"async\" src=\"https:\/\/i.ibb.co\/Gdpmrxp\/2018-02-21-15-07-36.jpg\" alt=\"2018-02-21-15-07-36\" border=\"0\"><\/a>\n\n\n\n<p>\nWith the help of some test code for the Memsic 2125 Dual-axis\nAccelerometer, I was reading values that would change upon moment of\nthe Accelerometer. Because I was not interested in the orientation of\nthe device, but solely if there was some slight movement, I could\njust compare the numerical output from one of the axes. If it varied\nenough, I could create some sort of alarm. Since this would be a\none-off project, I decided to etch a custom circuit board, and use\nthe Atmega328p, along with a RGB LED, to indicate the state the alarm\nwas in.<\/p>\n\n\n\n<a href=\"https:\/\/imgbb.com\/\"><img decoding=\"async\" src=\"https:\/\/i.ibb.co\/TPj4MDJ\/2019-02-22-13-14-47.jpg\" alt=\"2019-02-22-13-14-47\" border=\"0\"><\/a>\n\n\n\n<p> I decided that the RGB would flash red and blue when in alarm, and if enough alarms had been achieved in a set amount of time, an additional alarm type would be added, such as a buzzer, or car horn. If everything was normal, a green light would blink. I added a few potentiometers and a push button to vary basic values, such as sensitivity, time between alarm cycles, and number of first alarm cycles until type two alarm is activated. The programming this alarm helped me learn about programming timers and loops, as there cannot be any delays where information would fail to be processed.<\/p>\n\n\n\n<p><a href=\"https:\/\/pastebin.com\/bcXXjgp4\">Link to code<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Inspiration for a car alarm, what could that be? Around the beginning of 2018, I came into the prospect of buying a 2006 Jeep Liberty. I had been happily driving my 1998 Toyota Camry for years prior, and hadn\u2019t really thought about acquiring another vehicle, but something about 4WD, and driving a big powerful vehicle<\/p>\n<div class=\"more-link\"><a href=\"http:\/\/peernix.com\/?p=161\">Read More<\/a><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[6,10,11,16],"class_list":["entry","author-datz","post-161","post","type-post","status-publish","format-standard","category-electronics","tag-accelerometer","tag-arduino","tag-atmega328","tag-car-alarm"],"_links":{"self":[{"href":"http:\/\/peernix.com\/index.php?rest_route=\/wp\/v2\/posts\/161","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/peernix.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/peernix.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/peernix.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/peernix.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=161"}],"version-history":[{"count":0,"href":"http:\/\/peernix.com\/index.php?rest_route=\/wp\/v2\/posts\/161\/revisions"}],"wp:attachment":[{"href":"http:\/\/peernix.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=161"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/peernix.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=161"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/peernix.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=161"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}