Hackster is hosting Hackster Holidays, Ep. 6: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Monday!Stream Hackster Holidays, Ep. 6 on Monday!
PAJ
Published © GPL3+

Misfuel Defender

Had that moment of panic over which fuel you should be putting in your car? No! Then you're lucky. Yes! Then potentially a solution is here!

BeginnerFull instructions provided1 hour1,020

Things used in this project

Hardware components

Infineon TLE493D A2B6
×1
LED (generic)
LED (generic)
Colour Red
×1
LED (generic)
LED (generic)
Colour Green
×1
Resistor 330 ohm
Resistor 330 ohm
×2
Breadboard (generic)
Breadboard (generic)
×1
Jumper wires (generic)
Jumper wires (generic)
×2
Male Header 40 Position 1 Row (0.1")
Male Header 40 Position 1 Row (0.1")
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)

Story

Read more

Schematics

demo and connections

Demo of the project working and also connection details

schematic

image of breadboard layout

Code

MisfuelDefender

Arduino
Script for Arduino IDE
#include <Tle493d_w2b6.h>

Tle493d_w2b6 Sensor = Tle493d_w2b6();


int magnetDetected  = 0;
int red = 5;
int green = 4;

void setup() {
  Serial.begin(9600);
  while (!Serial);
  Sensor.begin();
  Sensor.begin();
 
  
  pinMode(red, OUTPUT);
  pinMode(green, OUTPUT);
}

void loop() {
  Sensor.updateData();
  
 
  magnetDetected = Sensor.getZ() + Sensor.getY() + Sensor.getX(); // Add all the values together if a magnet is detected the sum will be greater than 1
    if (magnetDetected == 0) { // if sum is 
  digitalWrite(red, HIGH);   // turn the Red LED on (HIGH is the voltage level)
    delay(1000); 
    // wait for a second
    digitalWrite(red, LOW);    // turn the Red off by making the voltage LOW
    delay(1000); 
  }else if (magnetDetected != 0){
    digitalWrite(green, HIGH);   // turn the Green LED on (HIGH is the voltage level)
    delay(1000);                       // wait for a second
    digitalWrite(green, LOW);    // turn the Green LED off by making the voltage LOW
    delay(1000); 
  }

}

Credits

PAJ

PAJ

3 projects • 7 followers

Comments