WEEK 11 - INPUT DEVICES

WEEK 11 - INPUT DEVICES

hero shot


testing the encoder of my final project with hall effect sensor i made this week

After a tedious machine week we are back to the usual flow. this week i planning to play with hall effect sensor which i can probably use in my final project.

assignment

individual assignment

  • measure something: add a sensor to a microcontroller board that you have designed and read it
    group assignment
  • probe an input device's analog levels and digital signals

group assignmnet

You can find our group page here and this week is here
Pasted image 20240417130855.jpg

about hall effect sensor

Hall-effect sensors are integrated circuits that transduce magnetic fields to electrical signals with accuracy, consistency, and reliability.

*from how to MECHATRONICS - how hall effect works*

MT811X

i am using the available 811 in our fablab inventory.The MT811X family of Hall effect sensors represents a cutting-edge solution for precise and reliable magnetic field detection in a variety of applications, with a particular focus on automotive systems. Built using advanced BCD (Bipolar, CMOS, DMOS) technology, these sensors offer exceptional performance and robustness.

Pasted image 20240416204815.jpg

from DATA SHEET of mt811x

BCD Technology: This technology likely refers to "Bipolar, CMOS, DMOS" technology, a common process for integrated circuits that combines Bipolar and CMOS transistors with DMOS (Double-diffused Metal-Oxide Semiconductor) transistors, offering benefits like high power efficiency and integration.

Pasted image 20240416204949.jpg

pin out and package of 811

Pasted image 20240416205133.jpg

811 is sensitive to the magnetic field component that is perpendicular to the top of the package

so the sensor doesn't measure magnetic flux but just says which is north and which south by turning high and low.

Pasted image 20240416205413.jpg

functional block diagram of 811

operating voltage - 2.8v - 24v
supply current - 3.5 - 6 mA

typical output of the ic is given below

Pasted image 20240416205714.jpg
Digital Output vs. Magnetic Flux Density

making the breakout board

the datasheet have a general application circuit DIAGRAM . i decided to mill the same board.

Pasted image 20240415125017.jpg
schematics i done using kicad

then i routed the ic .

Screenshot 2024-04-15 at 1.46.08 PM.jpg

layout from kicad

then i milled the circuit and soldered it. you can refer WEEK 8 - ELECTRONICS DESIGN for more details about electronics designing

IMG_8302.jpG

811 breakout board i have done

testing the output

i am not getting proper reading from the board when i uploaded sample code to analog output.
Pasted image 20240506202720.jpg

error readings

. so decided to probe the baord using an OSCILLOSCOPE.

we can use OSCILLOSCOPE an electronic test instrument which can be used to display varying voltages of one or more signals as a function of time.

i am using a bench power supply to power my sensor

Pasted image 20240417131632.jpg

power supply

Pasted image 20240417131134.jpg

probe pinout

Pasted image 20240417131930.jpg

the tektronix 5 series mixed signal oscilloscope i am using

Pasted image 20240417145327.jpg

from manual of this device

pin labels

  1. Acquisition and Cursors controls: Manage waveform acquisition, enable fast acquisition mode, set cursor parameters, and clear current acquisitions.
  2. Multipurpose knobs: Control cursor movement and configuration menu input values, with the ability to switch to Fine mode for precise adjustments.
  3. Trigger controls: Force trigger events, set trigger level and slope, and toggle between auto and normal trigger modes.
  4. Vertical controls: Adjust waveform position and scale, toggle channel display, and manage math, reference, and bus waveforms.
  5. Horizontal controls: Shift waveform position, adjust time scale, zoom in/out, and navigate through waveform records.
  6. Miscellaneous controls: Toggle touch screen, save instrument settings or screen captures, restore default settings, and perform autoset.
  7. Ground and Probe Compensation connectors: Provide grounding for anti-static protection and a source for probe compensation.
  8. USB Host ports: Connect USB flash drives or peripheral devices for data transfer or instrument control.
  9. FlexChannel probe connectors: Support various measurement probes and cables for signal acquisition.

Pasted image 20240417130855.jpg
connection setup

i took some neodymium magnets to test the sensor and anticipating to get low and high by moving magnets.


testing the magnets and getting digital output

OSCILLOSCOPE output

Pasted image 20240417140827.jpg

The current taken by the sensor during it's working at 5V constant ,It's about 0.00675 A only and the the output wave form we observe a straight line with out any operation.When we approach the magnet it goes high and when changed direction or removed magnet it goes low

programming with the sensor

i connected the sensor to the board i made in WEEK 8 - ELECTRONICS DESIGN and uploaded code to detect magnet.
Pasted image 20240417183336.jpg

“IMG_8350_compressed.mov” could not be found.
me the testing sensor

const int hallEffectPin = 31; // Pin connected to the output of the Hall effect sensor

  

void setup() {

pinMode(hallEffectPin, INPUT); // Set the pin as input

Serial.begin(9600); // Initialize serial communication

}

  

void loop() {

int sensorValue = digitalRead(hallEffectPin); // Read the digital value from the sensor

if(sensorValue == HIGH) {

Serial.println("No magnet detected"); // Print message if magnet is detected

} else {

Serial.println("Magnet detected!"); // Print message if no magnet is detected

}

delay(500); // Delay for stability

}

code- generated using chat gpt

Pasted image 20240506204134.jpg
this part code runs this loop digital read logic high and low and display the CORRESPONDING message saying whether amgnet DETECTED or not

final testing

application

i included the hall effect sensor for Final project which is an encoder wheel embedded with 6 magnets in it.

tesing the encoder as a counter

// Define the pin for the hall effect sensor

const int hallEffectPin = 31;

  

// Variable to store the count of magnet detections

int magnetCount = 0;

  

// Flag to track whether the sensor was already triggered

bool sensorTriggered = false;

  

void setup() {

// Initialize serial communication

Serial.begin(9600);

  

// Set the hall effect sensor pin as input

pinMode(hallEffectPin, INPUT);

}

  

void loop() {

// Read the state of the hall effect sensor

int sensorState = digitalRead(hallEffectPin);

  

// If the sensor detects a magnet (LOW state) and it wasn't triggered before

if (sensorState == LOW && !sensorTriggered) {

// Increment the magnet count

magnetCount++;

  

// Print the current magnet count

Serial.print("Magnet detected! Count: ");

Serial.println(magnetCount);

  

// Set the sensor triggered flag to true

sensorTriggered = true;

}

// If the sensor is not detecting a magnet (HIGH state)

// reset the sensor triggered flag to false

if (sensorState == HIGH) {

sensorTriggered = false;

}

  

// // A short delay to prevent rapid counting due to sensor noise

// delay(100);

}

the code

Conclusion

In conclusion, this week's assignment provided a deep dive into understanding and working with input devices, particularly the hall effect sensor. Through various steps including designing a breakout board, testing the output using an oscilloscope, and programming the sensor, I gained valuable insights into its functionality and applications. Integrating the hall effect sensor into my final project opens up possibilities for enhanced functionality and performance. Overall, it was a challenging yet rewarding experience that contributes significantly to my learning journey in the Fab Academy.