Guidance on Hall Sensor Digital Output Issue

Hi All:

I am working on a project where I want to automate model rail layout using arduino and hall sensor. I am in a beginning phase of my project where I am testing the stuff to figure out things. While testing the hall sensor (with digital output), I have observed that the voltage on the digital pin is different when using 9V battery or AC to 12V DC power adapter. With battery I get 3.7V on digital out and 1.7V with AC-DC power adapter (2 different power adapters tested). In all cases, I have passed the power source through Breadboard Power Supply Module before connecting with hall sensor.

I discovered this by accident. Digital input pin on Arduino mega was floating and randomly translating between zero and one. At first I thought that it could be a common ground issue. I ensured that the power supply GND, arduino Gnd and sensor ground are all connected. However, it did not solve my problem. So, I powered only the sensor without arduino and observed the above voltage difference.

I would really appreciate any guidance on this.

Below is the list of parts and circuit diagram is attached.

Hall Sensor
Battery
Power Adapter 1
Power Adapter 2
Breadboard Power Supply Module

I have used Hall effect switches in a game, but not the ones in a box of sensors that use a one-size fits all comparator PCB.

Here is a typical schematic:

If your Vcc changes, you need to readjust the variable resistor on the comparator.

Here is how I used the sensor chip in my game:
Hall Effect Sensor Switch Schema.jpg

Hall Effect Sensor Switch Schematic.jpg

Hall Effect Sensor Switch Schema.jpg

@SteveMann Thanks for the response. However, in both the cases, Vcc for the module is 5V, fed from the breadboard supply. I am using the below module.

Your picture suggests that you have shorted the 5V and 3.3V on the Arduino board. No wonder when you kill voltage regulators this way :frowning:

Measure the supply voltage at the sensor board. It should equal the controller supply voltage (5V?), and the sensor output should either equal that voltage or about zero, depending on the state of the hall sensor. Also adjust the sensitivity on the sensor board.

You really should measure all those voltages, not blindly trust your cabling, (broken?) boards and labels.

Try connecting a 10k pullup resistor between Vcc and D0, if the module is using a LM393 comparator or similar, the output is open collector, pulls to ground when active, floats when not. Use the onboard potentiometer to adjust trip distance.

@DrDiettrich Sorry for the messy image, if 5V and 3.3V look shorted. I have only connected 5V to the sensor and 3.3V pins are free.

@JCA34F Before measuring the voltage through Multimeter, I had connected the D0 to arduino digital pin as input with pullup resistor enabled. To test of the sensor status, I had connected one arduino digital pin as output to a LED (through 220R). Also, i had established common GND by connecting arduino GND to GND of Breadboard power supply. However, the LED kept flickering with power adapter but was fine with battery. Also, had checked the input received on serial monitor. It was a strand of alternating 0s and 1s with power supply.

The full circuit is attached. This is when i decided to test the output volts of D0 with multimeter.

I will try again and see.

The flickering LED indicates contact problems with the breadboard.

I don't understand the purpose of the breadboard power supply, if you don't use 3V.

Furthermore I wonder how you power the Mega, according to your Full Circuit? 5V from USB?

I strongly suggest: drop the breadboard power supply and power everything from the Mega. A 9V battery may work for a while, but verify that it is not already empty.

DrDiettrich:
The flickering LED indicates contact problems with the breadboard.

I don't understand the purpose of the breadboard power supply, if you don't use 3V.

Furthermore I wonder how you power the Mega, according to your Full Circuit? 5V from USB?

I strongly suggest: drop the breadboard power supply and power everything from the Mega. A 9V battery may work for a while, but verify that it is not already empty.

I have changed breadboards and jumpers to check for the flickering problem. If it was a contact problem shouldn't this present with 9V battery too. The flickering only happens with AC 12VDC power adapter. Moreover, the serial monitor shows strands of zeros and ones alternating. With 9V battery, everything works fine.

The end goal is to drive 4 motors (4 solenoid-based turn out switches which need 1A for 50ms to switch) and 5 hall sensors. As I am still in testing and programming phase, I am using this as test bench to have all all voltage options available. The plan is to use the 12V 5A power adapter to power everything by creating a power distribution PCB at a later stage.

As of now, mega is powered through USB connector. I will move it to 12V power adapter once everything works as expected.

Have you looked at the 12VDC power supply output with your multimeter? Would not be the first PS to have a problem

I don't have the oscilloscope but have checked with MM. I am getting 12.42V. I have another power adapter for 12V. I am getting the same thing. I have included the links of both adapters in the OP.

From:

Adapter Output Plug size: 5.5mm (Outer Dia) x 2.5mm(Inner Dia.)

From the other link:

Đầu ra Kích thước đầu cắm: Φ5. 5*2.5

The Mega barrel jack is 5.5 x 2.1 mm, bet that is your problem, the plug is not making firm contact with the smaller pin in the Mega’s barrel jack. Or the breadboard PS’s.
I’ve been there before, some higher Amp PSs have a 2.5 mm pin instead of 2.1, because of the higher current.

Thank for highlighting this. I guess I didn't notice that earlier. However, Mega is powered by USB right now.

For breadboard PS, I have checked the output pins of breadboard PS with multimeter. I am getting 5V and 3.3V on the perspective pins. Can it still be the problem?

Update-----
I changed the 2.5mm Dc connectors to 2.1mm connectors. The result is still the same. However, I have noticed one thing that the output from the sensor keeps fluctuating in second and decimal place like 1.7XX Volts, where XX keeps changing. However, with battery it is constant number.

Update:

I got 3144 Hall sensor and paired it with 10K resistor and now everything worked. I believe that there was some issue with module that I was using. I have 4 of these and all of them have the same issue.

Thanks everyone for the suggestions and help.