Pages at a moderate pace, you will not experience this issue. This issue, but, if you can exercise patience, and swipe through your Additionally,Īttempting to cover the sensors or swiping across the sensors rapidlyĬan cause the module to lock up. Not being able to read the data from stdout fast enough. Suspect it has to do with too much throughput, and the child process We haven't figured out exactly why, but we Milliseconds can cause the entire module to hang after running forĪpproximately 30 seconds. =MMM-Simple-Swiper= file, we did notice that anything less than 600 While messing around with the =delay= parameter of the config in the Wanted to take the code and utilize it in another project, please,įeel free. Since the C executable outputs raw values from the sensors, if you =MMM-page-indicator=, and has done so very well in our testing. Was intended to be run along side =MMM-pages= and On Debian Stretch), using two HC-SR04 ultra sonic sensors. This has only been tested on the RaspberryPi 3 B using Raspbian (based =MMM-pages= Github, with our module tucked nicely inside the Just so it's more clear, here's the example config taken from the Which are fixed in place (as the name would suggest). The =fixed= property contains the list of modules When using with =MMM-pages=, place =MMM-Simple-Swiper= within the SensorDelay: 10, // the number of microseconds each sensor waits to check for changes in voltage (fine tune this for CPU performance) MagicMirrorDelay: 1000, // number of milliseconds between passing data from C executable to the node_helper for MagicMirror to act upon Also, please read the =Tested Conditions/Warning= sectionĭistanceDiff: 1.25, // difference between both sensorsĭebug: false, // if true, the raw data is printed to stdout while MagicMirror is running The default config is shown below, and the order in which the valuesĪre listed are not important. IMPORTANT: Do not forget to add a resistor to the Echo wire.This in an attempt to be transparent, and asure you no funny business Takes care of the permissions required for the GPIO pins. Notice the first argument of the =spawn= function being =sudo=, which Var child = require("child_process").spawn("sudo", [ The code snippet where this occurs is shown below: This is due to the small hack (I guess it canīe considered a hack?) used when launching the child process within When running this module, there is absolutely no need to execute $ cd ~/MagicMirror/modules/MMM-Simple-Swiper & makeīe sure to add the snippet for your =config.js= file below. #+BEGIN_SRC sh assuming mmpm is already installed You can either follow the manual instructions for installation below, or you can make use of the =MMPM (Magic Mirror Package Manager)= found here: | Recommended MagicMirror Modules | Link | | WiringPi | =sudo apt-get install wiringpi -y= | | Library Dependencies | Link/Installation | When you clone this repo, install the =wiringPi= library using the instructions from the table below, and run and =npm install= inside repo's directory. This module has three dependencies, all of which are listed in the Lines of code.including the Makefile), so the code is (hopefully) Also, we tried to keep it as lightweight as possible (280 "Bazinga" - Sheldon Cooper) of things to keep it fast andĮfficient. The overwhelming majority of the work is done on the C-side (get it? Which sends a notification to the =MMM-pages= module. Values, a socket nofication is sent to the =MMM-Simple-Swiper= module, If the values meet thisĬriteria and there is a large enough difference between the two To see if both are within a certain threshold. =stdout= in a =:= format, which is read by the child The two threads are joined, and the averages are printed to Measurements, remove the outliers, and calculate the averageĭistance. Inifinte loop, two threads are created to collect the distance The JSON string is parsed, the valuesĪre stored in structs, and an infinite loop is entered. Which calls a C executable, and supplies the JSON config as a command The =node_helper= then creates a child process, =MMM-Simple-Swiper= modules loads, it sends a socket notification to This module attempts to determine distance/motion based on the outputįrom the sensors in a simple, efficient manner. Searched online for answers, and found many people having the same Modules built to do just that, but none of them worked. When searching through the modulesĪvailable on the MagicMirror wiki, we found a couple of pre-existing Sonic sensors to detect motion, so we could change the currentlyĭisplayed page, and feel like wizards who commanded technology using When setting up our MagicMirrors, we wanted to use two HC-SR04 ultra ** What is this, and why did we make this module?
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |