FANDOM


Week 9: 10th October to 16th OctoberEdit

I got to work on implementing the frequency counter method. Several problems arose. I was unable to pinpoint the exact period between peaks because the values fluctuate too fast for the microcontroller to read in. As soon as the next peak was reached, the system barely had time to register because the ADC value changed too quickly. I tried a latch on method by storing the values in a variable first, but the same problem persisted.


I decided to abandon the frequency counter method. Similar to the problem I had with the implementation that uses the voltage values, I discovered in my experiment that the frequency was also susceptible to variations as the distance of the hall effect sensor from the electromagnet changes. The user experience would be severely limited if I were to continue to use this method.

I went back to the drawing board and thought of two methods. By implementing a sudden drop in PWM for each electromagnet one at a time, I am able to artificially create a sharp spike in the ADC reading. With that in mind, I figured that I could implement a different spike interval for each electromagnet. Specifically, for the first electromagnet, I will implement a voltage spike in PWM every two seconds. For the second electromagnet, I will implement a voltage spike in PWM every three seconds and so on. All electromagnets will be set to the same PWM at full power of 255 and the drop to be initiated will be the same across all the electromagnets at approximately 100 before setting it back to 255 again. The result is a spike on the oscilloscope every few seconds for each electromagnet. However, because the microcontroller is only able to execute one command at a time, I need to use another microcontroller to measure the check for the voltage drops while the other microcontroller controls the electromagnets. It is more resource intensive and I have to continually switch between microcontrollers during my programming.

I came up with another method that uses only one microcontroller. I will be implementing the same voltage spike in the aforementioned idea. For each electromagnet, I will set them at full power at 255 PWM and initiate a voltage spike. This will be done sequentially. So it goes like this. The first electromagnet will be at full power, and a sharp spike will occur and the ADC reading will be checked. If the hall effect sensor is indeed above the electromagnet, it will be able to detect the sudden change in voltage and ascertain which electromagnet the hall effect sensor is positioned above of. The same goes for the second electromagnet and so on. I call this a probing method because the hall effect sensor is probing for a voltage spike to determine the electromagnet. In short, I will initiate a spike, check ADC value and actaute if spike is detected. If not, I will move on to the next electromagnet.

Experimentation with the 2nd idea yielded several revelations about the operations of the setup. Firstly, I discovered that the third and the last electromagnet was unable to initiate the sudden turning on and off of the electromagnet in order to generate the spike in the ADC value. Also, the zero field ADC value without any magnetic field present happens to be very close to the ADC value when the PWM is set to 100. I compensated for this by setting the PWM during the off state to be slightly higher at 120 PWM. I will have to fix the third and last electromagnet in order to fully test my idea out.

By the end of the week, I had fixed the last electromagnet, but the third electromanget continued to exhibit some issues. It could not turn on at all! It turns out the that particular electromagnet had burned out and was no longer working. I had to replace it with another electromagnet. Once that was done, all six electromagnets were working again.

There were several issues with the spike implementation I had in mind. I also found out that the spike for each electromagnet occurred almost concurrently, rather than sequentially like I had hope. This is probably because the instructions were executed very quickly, giving the impression that the electromagnets were turning on and off at the same time. Note the image below of two hall effect sensor readings on the oscilloscope for the 1st and 4th electromagnet. The spikes appears to be initiated at the same time. To address this problem, I attempted to implement a longer delay in between but I discovered that the hall effect sensor was able to pick up the spike from neighbouring electromagnets and mistakenly confused the neighbouring sensor for the other. Once again, I am back to square one. Given that the aim was to eliminate messiness due to the ferrofluid, perhaps its time to consider some other form of material that will not stick to the neodymium magnet input from the first setup. Ball bearings can be an alternative.

Photo

Hall effect sensors of 1st and 4th electromagnets

Objective Checklist

  • Investigate the effect of replacing ferofluid with ball bearings instead.