Descrição
Mexico recycles around 60 % of all PET bottles consumed in its internal market and is the leader in food-grade recycled PET. Mexico leads this industry above the USA and Canada, and its contribution is not just economical but more so, a measure to improve our environment. The PET recycling industry faces the challenge of the inefficient process to recover a PET bottle from waste. The aim of this work is to facilitate the recovery process of a PET bottle for recycling by designing and implementing an affordable recycling machine. There are two key components devised in this work to accomplish this goal: the infrared sensor stage and the operative system; both components are embedded into the same low power microcontroller from the Cortex M4 family. The sensor stage is based on infrared pairs connected to the microcontroller ADC input, a self-calibration sequence calculates the necessary offset to compensate for the hardware bias. This calibration takes place one time during initialization. Several tests were performed to tune the sensor output so that it could be used as a threshold level to distinguish a PET bottle. A second sensor used is the E3ZM-B OMRON, this device reinforces the sensor stage as the output is connected to the microcontroller input, which determines if a PET bottle is on the conveyor. The second key component of this work is the operative system, a multi task, and fully preemptive system is embedded into the microcontroller, it manages the machine operations by means of tasks processed depending on its priorities, a high priority task can interrupt a lower priority task, this is known as preemption which is achieved by a context switch. In this work, the context switch lead to a not deterministic microcontroller behavior and the PC register was loaded with the wrong return address needed to continue with the program execution. As a result, the periodical tasks were processed correctly but they should last no longer than 1ms, as it is not possible to preempt them. On the other hand, the sensor stage worked as expected with the sole condition of avoiding a beam of light.