How to check the Hall sensor?

JSP007
Posts: 3
Joined: Sat Aug 10, 2019 7:18 pm

How to check the Hall sensor?

Postby JSP007 » Sun Aug 11, 2019 8:55 am

Is there a way to test the Hall sensor for hardware failure? Maybe to connect directly to it?

I have tried the Example Hall sensor but I get only noise (it looks like a disconnected pin). My ESP32-EVB is OK as the other examples work nicely.

Any suggestions would be much appreciated! Thank you very much in advance.

lbernstone
Posts: 826
Joined: Mon Jul 22, 2019 3:20 pm

Re: How to check the Hall sensor?

Postby lbernstone » Mon Aug 12, 2019 4:31 am

Does it work better if you do?

Code: Select all

#include "driver/adc.h"
Serial.println(hall_sensor_read());

JSP007
Posts: 3
Joined: Sat Aug 10, 2019 7:18 pm

Re: How to check the Hall sensor?

Postby JSP007 » Mon Aug 12, 2019 8:08 am

Thank you very much lberstone.

I am sorry to say that the output continues to be a noisy signal.
This is such a simple code so I must be overlooking something basic or else there is a faulty hardware, which usually is not the case. Should I fetch the "driver/adc.h" from some specific place? Here is my code now.

Code: Select all

//Modified sketch to access the internal hall effect detector on the ESP32.
// DLC 20190812 by JSP

#include "driver/adc.h"

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

void loop() {

  Serial.println(hall_sensor_read());
}


//Re: How to check the Hall sensor?
//Postby lbernstone » Mon Aug 12, 2019 5:31 am
//
//#include "driver/adc.h"
//Serial.println(hall_sensor_read());

lbernstone
Posts: 826
Joined: Mon Jul 22, 2019 3:20 pm

Re: How to check the Hall sensor?

Postby lbernstone » Mon Aug 12, 2019 12:36 pm

The hall sensor uses pins 36 and 39 in operation. It looks like the esp32-evb uses those pins (U1RXD and IR_RX). https://docs.espressif.com/projects/esp ... eading-adc. If you buy a cheaper dev board without so many fancy gadgets the hall sensor should work.

boarchuz
Posts: 605
Joined: Tue Aug 21, 2018 5:28 am

Re: How to check the Hall sensor?

Postby boarchuz » Mon Aug 12, 2019 9:59 pm

Also from that link:
The ADC1 module must be enabled by calling adc1_config_width() before calling hall_sensor_read(). ADC1 should be configured for 12 bit readings, as the hall sensor readings are low values and do not cover the full range of the ADC.

Code: Select all

adc1_config_width(ADC_WIDTH_BIT_12);

Who is online

Users browsing this forum: No registered users and 133 guests