FANDOM


Week 7 26th September to 2nd OctoberEdit

This week’s meeting was pushed back due to the MDA directors’ visit. That said, I managed to get a hold of Kasun to discuss the problems and the solutions I have thought of last week. With regards to attaching rare earth magnets on the top of each electromagnet in order to boost the readings on the hall effect sensor, it have little effect on the readings. I did a preliminary test by attaching a neodymium on the top of an electromagnet and positioning a hall effect sensor 1.5 cm above it. The readings continued to vary and follow a sinusoidal patttern. In fact, because of the close proximity of the hall effect sensor above the neodymium magnet, the readings I got was actually that of the neodymium magnet and did not reflect the PWMs of the electromagnets. As such, the first solution I had was moot.

The 2nd solution of calibrating the hall effect sensors is workable but it is not without hassle. Firstly, there is a need to construct a contraception that can hold all six of the hall effect sensors and position them at a certain distance above the electromagnets. Next, I will need to find a way to program the system to enter a calibration mode, possibly through a Java program from the computer to the ATMEGA2560 microcontroller via the RS232 interface. In addition, I will have to find a way to ensure that enough memory is available on the microcontroller to store the huge amount of data that is required to compare with the hall effect sensor input. Given the complexity surrounding this solution, I decided to table it for now.

After a brief discussion, Kasun and I deliberated on the possibility of spitting the system into two microcontrollers. This is because I am currently able to program the system to comfortable detect the voltage levels of three electromagnets. More specifically, I can afford to set a larger range of voltage values the hall effect sensor gives out, thereby giving a more intuitive response. As such, if I were to spit up the six electromagnets to three electromagnets per microcontroller, I will be able to comfortable actuate each of the buttons easily without being limited to the small range of voltage values as the number of electromagnets I need to detect increases.

Another solution will be to use two hall effect sensors instead. With each electromagnets set to different PWMs, I find that the hall effect sensor readings swings widely with a small change in distance above the electromagnet. I can exploit this behaviour by attaching two hall effect sensors to a finger, one above and the other below it. With this implementation, I will be able to program the microcontroller to check for two conditions. The microcontroller must be able to detect that the first hall effect sensor closest to the electromagnet is within a predefined voltage value. In addition, the second hall effect sensor that is slightly above the first hall effect sensor must also be within another predefined voltage value. I have ascertained that no two voltage range are the same for each electromagnet. That is to say, each pair of voltage values detected by the new pair of hall effect sensors input implementation are unique and different for each electromagnet. In short, they differ enough for me to program the system to be able to discern the different electromagnets more accurately. If I were to adopt this method, I will have to come up with a wearable attachment to find out the working range for the two hall effect sensor to program into the system. This is because for this to work, the hall effect sensor pair must always be at a fixed distance apart from each other. Once that distance changes, the values of voltage readings relative to each other will change widely and I will have to program a new set of values into the microcontroller.

I decided to implement the latter solution because it seemed the most feasible. Taking a small clay toy, Shiny Putty that the lab had from a previous project, I moulded a simple shape and attached two hall effect sensors on it, one above, the other below it. After that was done, I extended another hall effect sensor wires so that it will be more convenient to move it around without being limited by its original shorter wires.

IMG 0660

A rudimentary setup to test the effectiveness of two hall effect sensors placed a certain distance apart

Despite my belief that I would be able to distinguish between the six electromagnets with this method, I was sadly mistaken. It turns out that the second hall effect sensor differed little, especially between the third electromagnet programmed at 150 (digital) PWM and fifth electromagnet programmed at 100 (digital) PWM. Moreover, because of the fact that there is now two conditions to be met in order to trigger a musical note, detecting a electromagnet has become slower and less responsive.

I came up with another idea of reintroducing the array of six hall effect sensors, only this time round, instead of attaching the hall effect sensors on the top of the electromagnet, they are to be attached to the sides instead. The idea is that the hall effect sensor readings of the magnetic field generated at 1.5cm above the top of the electromagnets are similar to the hall effect sensor readings at the side. In short, I had assumed that the magnetic field generated was spherical. I confirmed this by attaching a hall effect sensor on the side of an electromagnet. Subsequently, I compared the hall effect sensor readings above and the second hall effect sensor. On the oscilloscope, they looked identical. I then sought to exploit this property by comparing the hall effect sensor reading on the wearable with each of the hall effect sensor attached to the electromagnet. The system would then be able to ascertain which hall effect sensor reading is identical to that of the hall effect sensor on the wearable and then discern the electromagnet the wearable is positioned above of.

IMG 0663

Attaching a hall effect sensor to the sides of the electromagnet

Unfortunately, this turned out to be more difficult to implement. I had mentioned earlier that the magnetic fields generated are too identical. As such, the same problem of confusing between the electromagnets of similar PWMs arose yet again.

I decided to discuss the problem with Jeffrey. He acknowledged the difficulty of detecting six electromagnets via thei voltage readings generated by the hall effect sensor. He then went on to suggest a few new implementations. One of which entails the use of an electromagnet with a large surface area. As the hall effect sensor approaches the ferofluid, the spikes generated will be programmed to reduce in number and size, giving the user the impression that he/she is shaping the ferofluid. I suggested another implementation where we can retain the six electromagnets and have two wearables, one on each hand. Each wearable will have a hall effect sensor and can only actuate three electromagnets. As I had mentioned before, I am able to program the system to comfortably actuate three electromagnets. Having two hall effect sensors which each of them dedicated to three electromagnets will make for a system that is able to detect all six electromagnets with two hands. However, Jeffrey pointed out that while the idea was a good start, users have a tendency to assume that they will be able to actuate all six electromagnets with one hand. One way to circumvent this would be to position the electromagnets in a way that is able to inform users that only three electromagnets can be actuated with one wearable. That is, we split up the electromagnets into two groups and have the users don the wearables on each of their hands.

Another way would be to introduce only five electromagnets. According to Jeffrey, there is a game that can be implemented with five musical notes. Right now, I can only achieve detection of four electromagnets. If I can increase that to five, I would be to implement the new music game.

With this in mind, I went back to the ATMEGA2560 microcontroller datasheet. After perusing it, I realised that it is possible to increase the prevision of the ADC value generated by read_ADC(channel_no) from 8 bits(255) to 10 bits(1024). This is achieved by setting ADLAR bit in the ADMUX register to 0 and left justifying the bits. This is followed by a command to read off the ADCL register followed by the ADHL register. A shifting to the left by 8 bits of the ADHL register is necessary before concatenating the two registers. With this, I have achieved a wider precision of the ADC value. It is hoped that I will be able to acquire a wider range of ADC values to work with.

The next day, I begin work on adjusting the analog threshold values from 255 to 1024. That said, the added precision was not enough to garner a reliable and accurate acctuation of the correct electromagnet.

Next, I tried implementing a calibration step, in which the hall effect sensor is held over each of the electromagnet and the analog value above each of the electromagnet is recorded. This will eliminate the problem of voltage values that changes as the temperature of the electromagnets increases with time and also allow for a more robust system that can operate under different power level conditions.


The code for the calibration step is as follows:

void Calibrate_5_6(void)
{
Wait(10000);
USART_Transmit0(50); //sound off to begin calibrating
Store_ADC_Array(1); //store analog values of 1st electromagnet

USART_Transmit0(59); //calibration of 1st magnet ended

Wait(10000);
USART_Transmit0(50); //sound off to begin calibrating

Store_ADC_Array(2); //store analog values of 2nd electromagnet

USART_Transmit0(59);  //calibration of 2nd magnet ended

Wait(10000);
USART_Transmit0(50); //sound off to begin calibrating
Store_ADC_Array(3);//store analog values of 3rd electromagnet

USART_Transmit0(59); //calibration of 3rd magnet ended

Wait(10000);
USART_Transmit0(50); //sound off to begin calibrating

Store_ADC_Array(4);//store analog values of 4th electromagnet

USART_Transmit0(59);  //calibration of 4th magnet ended

Wait(10000);
USART_Transmit0(50); //sound off to begin calibrating
Store_ADC_Array(5);//store analog values of 5th electromagnet

USART_Transmit0(59); //calibration of 5th magnet ended

Wait(10000);
USART_Transmit0(50); //sound off to begin calibrating

Store_ADC_Array(6);//store analog values of 6th electromagnet

USART_Transmit0(59);  //calibration of 6th magnet ended

}


However, I was only to accurately detect the first four electromagnets. Because the PWM set to the fifth and the first electromagnet were so close(250 and 160 respectively), their voltage values varied very little, even when I tried to using different heights above the electromagnet. For example, I recorded the analog value of the first electromagnet at 0.5 cm above it and recorded the analog value of the fifth electromagnet at a distance of 3 cm above it. Finally, I tried to set different combinations of PWM to the first and the fifth electromagnets (200 and 100, 255 and 150 etc), but the voltage values continued to differ very little. The microcontroller kept confusing the fifth electromagnet for the first one. This is because the program is set such that if the first condition for the first electromagnet is set, the rest would be ignored. That is why the system could never get down to testing for the fifth electromagnet as the first electromagnet condition had already been met. The code for this is as follows:

if(value >=ADC_Value[0]-50) //comparing with calibrated value of 1st electromagnet
{
SensorState = 1;
}
else if((value >=ADC_Value[1] -100 ) && (value<=ADC_Value[1] +100 )) //comparing with calibrated value of 2nd electromagnet

{
SensorState = 2;
}
else if((value >=ADC_Value[2] -100 ) && (value <=ADC_Value[2] + 100))//comparing with calibrated value of 3rd electromagnet

{
SensorState = 3;
}
else if((value >=ADC_Value[3] -100) && (value <=ADC_Value[3] +100))//comparing with calibrated value of 4th electromagnet

{
SensorState = 4;
}

else if((value >=ADC_Value[4] - 75) && (value <=ADC_Value[4] +75)) //comparing with calibrated value of 5th electromagnet

{
SensorState = 5;
}
else if((value >=ADC_Value[5] - 75) && (value <=ADC_Value[5] + 75)) //comparing with calibrated value of 6th electromagnet

{
SensorState = 6;
}
else
{
SensorState = 0;//otherwise, do not actuate any electromagnet
}

I will have to rethink the problem and discuss new solutions that can be implemented during next week’s meeting.


Objective

  • Continue to research on new ways to implement accurate actuation of electromagnets.
  • Source out a large electromagnet that can implement Jeffrey’s new idea