Automation Code
This circuit measures both distance and motion to determine both the size and species make-up of any rescue crowd. This is to determine human/livestock count prior to boarding, to help streamline the rescue boarding process. If the human:livestock rescue ratio is too high, livestock cages can be converted to additional seating to help rescue more humans. Any rescue teams on the ground should group humans together and livestock together to help the automation system count. This circuit is currently coded so moving objects (above a movement threshold of 500) closer to the plane (within 150 m) are assumed to be human, and moving objects further away (at least 150 m) from the plane are assumed to be livestock. The sensors automatically track the counts of both humans and livestock, displaying the count on the LCD screen. This helps the rescue plane’s crew determine seating arrangements quicker to begin the rescue boarding process as quickly as possible, or to determine if additional rescue planes are needed.
The two inputs are the topmost sensor and the rightmost sensor. The topmost sensor with the green box is the PIR (passive infrared) sensor, which acts as a motion detector. The rightmost sensor is an IR (infrared) sensor, which measures the distance. The two outputs are the green LED light, which turns on when motion is detected, and the LCD screen, which displays if human or livestock is detected, as well as a live count of humans and livestock.
Code
This code works exactly as intended, it displays a live count for both humans and livestock, and when motion is sensed the green LED flashes on. The main issue I had was the PIR sensor was displaying values between 0 and 1023, instead of just 0 for no motion detected and and 1 for motion detected. After I decided a threshold for the motion of 500, the PIR sensor worked fine.
I have coded before this project, in a few different languages (HTML, Java, C++). This was similar in the aspect that coding is just coding, but it was also quite different than what I’m used to, as I’ve never coded an Arduino before. The introduction of a new element like a mini-computer is exciting and makes the prospect of continuing to learn about programming quite exciting. Now that I have an understanding of automation coding, I wish I could automate all the lights in my house to be motion detecting, as many light switches in my house are inconveniently placed. I wish I was able to add a motion detecting and object differentiating camera to my circuit, one that’s able to determine humans from livestock immediately. That does currently exceed my ability to code, although I am excited to continue learning about programming languages and circuits so I can eventually gain that skill.