AST1006-D

jsgagnon

  • Newbie
  • *
    • Posts: 1
    • View Profile
for the AST1006-D,
I am looking to connect the sensor directly to a arduino uno
From the schematic of the sensor (Vcc, grd, sdk, sda)
I am connectig the module pins to the typicals associted pin of the arduino Unoa

it does seem to work using the source code available for the arduino uno AST1006-D

Any idea on the pin configuration I should used?? Thank



lennevia

  • Administrator
  • Hero Member
  • *****
    • Posts: 437
    • View Profile
Hiya JS,

I know I answered this over email, but I thought I would copy the response here if anyone else runs into the same question:

The digital hall sensor relies on an analog pin rather than an I2C (SDA/SCL) connection. So the three pins you would need to connect are A0, GND, and 3.3V. Then you could use this code example that I have modified from what’s available in the tutorial(https://learn.tinycircuits.com/Wirelings/Hall-Effect_Wireling_Tutorial/#digital-hall-effect-wireling):

Code: [Select]
#define magPin A0        // Corresponds to PORT# of Wireling used (Do not use A0)
bool hallOutput = 0;     // What is directly output from Wireling
bool magnetDetected = 0; // Make sense of output

void setup() {
  Serial.begin(9600);

  // Set Hall Switch Pin to input
  pinMode(magPin, INPUT);
}

void loop() {
  hallOutput = digitalRead(magPin); // If no magnet, hallOutput == 1
  magnetDetected = !hallOutput; // Flip the hallOutput so magnetDetected == 1 when there is a magnet

  Serial.println(magnetDetected);
}

For the three pins you would need to connect to the Arduino Uno (GND, 3V3,INT), you can look at the diagram in this tutorial: https://tinycircuits.com/blogs/learn/make-your-own-wireling-using-a-wireling-cable

The Breakout Wireling is a great quick reference of the pin layout as well (all Wirelings have the same pin connector order of GND, 3V3, SCL, SDA, INT): https://tinycircuits.com/collections/wireling-input-output/products/0-1-breakout-i2c-wireling


 

SMF spam blocked by CleanTalk