Hello! Welcome to our final week blog on this project. In case this is your first time looking at our project I would highly recommend you go back to our project blog 1 to view an introduction to what we are doing on this blog.
Since our last project blog, we have developed a working prototype using both an encoder motor and the photo interrupt sensor. Unfortunately we have had to cut back on the complexity, however, we have still kept the core project idea intact.
We have also created a separate blog on Alex Yallop’s account which talks more into an encoder motor if you want to know what they do. Also in that blog, we talk about what booleans are and what a PID library is.
What was our problem?
When integrating our two working codes, we came across an issue involving serial printing and reading. Both of our sensors conflicted as they needed to write to their individual serial monitors.
The photo interrupt sensor module needed a clean input to designate the level of smoke in the air and give instructions appropriately.
The hall magnetic field sensor in our encoder motor needs to have a clean, high refresh rate serial monitor to print the RPM and reliably give it to the motor.
How we have adapted
We have integrated both of our codes, but we have decided to take out the feedback loop to the motor as we have to print to the same serial. Having the feedback loop read from the same serial would cause the code to not function effectively.
What does our prototype do?
Our prototype reads the level of smoke in the air and gives out 4 different values that have different actions attached to them. Depending on the level of smoke, a buzzer activates going up incrementally in the amount of noise. A motor is activated alongside this when the smoke covers the sensor and gives out a value greater than ‘200’. The encoder attached to the motor read the RPM that the motor is giving off.
Our final code is embedded below which you can click on to view in full. In the Code, you can clearly see annotations of what each part of the code does including the four different values and the actions attached to these.
Above is our final fritzing diagram for our project. As you can see above, our sensors are not in the default library and we cannot seem to find appropriate components to import. As an alternative, we have used a 6 pin stepper motor to resemble the encoder and a photo interrupter instead of the sensor version.
Above shows the prototype in action. This can be seen on my Youtube channel.
In the video, the photo interrupt sensor is being blocked by a piece of card simulating dense smoke. This triggers the buzzer to sound and starts the motor, the encoder reads the speed of the magnet on the back of the motor. Both the information about the RPM and the level of smoke is displayed on the monitor.