Week 8: 3rd October to 9th SeptemberEdit
I decided to modify the calibration step I introduced last week. Specifically, I programmed the system to take in multiple analog values over a short period of time as opposed to only one analog value. I have observed that the hall effect sensor readings produces different waveforms when positioned 1.5cm over the different electromagnets. That is to say, the set of values over time are distinct and unique to each electromagnet. Therefore, taking more values takes into account the fluctuating values and would enable the system to discern between the different electromagnets more accurately.
I have defined three constants, namely sampleSize, sampleTime and ThresholdRange. sampleSize allow me to vary the number of samples to take during calibration and readings. sampleTime allow me to vary the time between each sample. ThresholdRange determines the difference between the recorded calibrated values and the readings being scanned during normal operation (when scanning for different electromagnets). These three constants will make it easier for me to varying the sampling variables without having to laboriously alter every line. The result of this implementation was almost the same as that of last week. Only four electromagnets could be detected. The fifth and the sixth electromagnet continued to be mixed up the 1st and 2nd electromagnet. I attempted to narrow the sensitivity by reducing the ThresholdRange, but as before, it remain irresponsive. This is likely due to the difficulty in keeping the hall effect sensor perfectly still at the exact calibrated position. I decided to experiment with the two hall effect sensors again and having them at different positions above the electromagnets to determine the optimal position in producing a more distinct set of readings. I found out that placing the two perpendicular the electromagnet facing each other yielded the most distinctive set of readings on the oscilloscope. I then proceeded to use the clay Silly Putty again to construct a mould to hold the two hall effect sensor in that position. Next, I modified my code to take in readings from the 2nd hall effect sensor during calibration and added the new conditions to be met(that is, both the 1st and the 2nd hall effect sensor readings have to be within the programmed threshold range before the electromagnet can be detected). The results are promising. The system is able to detect five electromagnets, although there is a problem in getting some of the electromagnets to respond to the hall effect sensors. I believe this is due to the threshold value range I have set. The video below demonstrates the progress I have made so far.
Despite the improvement, I believe that this implementation is unreliable and inaccurate in detecting the exact position of the electromagnet. I intend to discuss with Jeff on another solution which I had earlier last week, that is using two wearables instead of one. I am able to program the system to accurately detect three electromagnets. By dedicating three electromagnets to each wearable, the response will be far more accurate and intutive for users. The system as it stands now requires quite a bit of finesse, meaning to say the user has to really hold the wearable really still before the electromagnet can be distinguished. I did a research on the internet and found that hall effect sensors ADC values have a tendency to fluctuate. I also managed to find some larger electromagnets supplied by Magnetech Corporation to implement Jeff’s idea of using a single bigger electromagnet instead. There are some hall effect sensors available on element14.sg, but we were sceptical as to whether they will be more sensitive than the ones we already have. Later in the week, I approached Kasun and another member of the staff to discuss the technical problems I am facing. Using the oscilloscope, we discovered that the fluctuating inputs of the ADC values I am getting from the hall effect sensor without any electromagnets is about 50 Hz. We assumed that it was due to the power supply from the ATX power supply. Next, we tested the hall effect sensor ADC values and changed the coupling setting of the oscilloscope so that it would read AC values. The aim is to try to determine whether the frequencies of the ADC values when positioned above the electromagnets differ enough to be used to differentiate them. The waveforms on the oscilloscope looked different enough. As such, it is possible to differentiate the electromagnets using the frequencies emitted by them. However, it can be difficult to implement a counting function that is able to determine the frequency. The idea I have is to implement a calibration step again. For each electromagnet, I will record an ADC value and increment a counter until the same value is reached. This give me an estimation of the period and by extension the frequency of the waveforms. Once this is done, I will store all the periods into an array and have the hall effect sensor continuously calculate the period until the calculated period tallies with one of the values in the array. That will identify the electromagnet that the hall effect sensor is positioned above of. Objective
- Implement frequency counter to determine the frequencies of the ADC values detected by the hall effect sensor