Hall sensor and ESP32

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
User avatar
budman1758
Normal user
Posts: 301
Joined: 15 Apr 2017, 05:13
Location: Riverside CA USA

Hall sensor and ESP32

#1 Post by budman1758 » 05 Oct 2022, 03:46

OK, so I have this linear actuator I want to control with an ESP32. According to the vast amount of documentation (har har) I got with it, it has a hall effect sensor in it. What I am trying to do is read that sensor and during movement when the movement stops I want to trigger a relay to cut the power to it. Power cuts automatically ant the end of the stroke each way but this install will stop somewhere during the stroke and I need power to cut at that point.

I have tried to connect this sensor to the ESP as a pulse counter and also to pin 22 as a hall sensor and have not gotten any readings that make sense. If I cannot get that working my next try will be a current sensor. Seems like I should be able to read the built-in sensor though. Here is a picture of the wiring for it. I connected it to 3.3 volts. Don't know if that's enough voltage but wanted to try it without level converting and all that. Ideas and guidance would be most appreciated.
Attachments
linear actuator wiring.jpg
linear actuator wiring.jpg (47.74 KiB) Viewed 3131 times
"The glass is twice as big as it needs to be".

User avatar
chromo23
Normal user
Posts: 821
Joined: 10 Sep 2020, 16:02
Location: germany

Re: Hall sensor and ESP32

#2 Post by chromo23 » 05 Oct 2022, 08:11

Without a datasheet of the actuator it is hard to tell.
Most probably the hall sensor doesn´t work with 3.3volts.
I have flow sensor with a hallsensor that didn’t work either until i supplied it with 5volts. (as input the esp32 as well as the esp8266 can handle that ammount of voltage).
Can you provide a datasheet or the brand and model you have?

Edit:
for 5Volt tolerance you can find infos in this forum:
viewtopic.php?t=8845
The schematic in your post seems to only show the wiring of the hall-sensor (even though there is linear actuator written on it). If that´s so, than you can go ahead and use the 5volt for the hall-sensor (but don’t power the esp32 with this 5volts as well!!!!)

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Hall sensor and ESP32

#3 Post by TD-er » 05 Oct 2022, 08:38

The "Motor - PWM Motor" plugin is intended to positioning a linear actuator.
However, I made it to support one with a tacho encoder (pulses), not a potentiometer.
Right now it is a bit tricky to act on samples from the ADC and call a stop command from the rules, as this will take some (random) time to react and thus cannot be used for exact measurements.
But if exact positioning isn't that important, you could give it a try.

However, I have to admit I haven't yet documented it anywhere.

The commands are:
pwmmotorhome // Run the motor in reverse till limit A switch is reached
pwmmotorend // Run the motor forward till limit B switch is reached
pwmmotorforward // Run the motor N steps forward, N <= 0: Move till limit B switch is reached
pwmmotorreverse // Run the motor N steps in reverse
pwmmotorstop // stop moving
pwmmotormovetopos (will only work with encoder)

Events: (All events are prepended with "taskname#")
limitA
limitB
positionReached
encoderTimeout

User avatar
budman1758
Normal user
Posts: 301
Joined: 15 Apr 2017, 05:13
Location: Riverside CA USA

Re: Hall sensor and ESP32

#4 Post by budman1758 » 05 Oct 2022, 17:27

chromo23 wrote: 05 Oct 2022, 08:11 Can you provide a datasheet or the brand and model you have?
All the info I have is whats available here. https://www.amazon.com/gp/product/B072F ... UTF8&psc=1
Or here. https://zoomindustrial.com/products/zoo ... -resistant
TD-er wrote: 05 Oct 2022, 08:38 The "Motor - PWM Motor" plugin is intended to positioning a linear actuator.
In what esp32 build can I find that plugin? I don't see that in the plugin list.

Exact positioning is not really important. This is an experiment. The application is a parking brake apply mechanism on my old truck. The linear actuator will push a cable connected to the parking brake and basically will push until it stalls and at that point the power needs to cut out. Power cutout just needs to happen within a few seconds so as not to burn out the motor. This is why exact position is not necessary either. As brakes and cable wear occurs the position will change over time. As for the other direction the actuator has limit switches that cut power at end of stroke. It might be easier to use a current sensor for this for those reasons. I need to determine how much current it pulls when stalled.

My first instinct was to use a RPI Pico for this using MPYEasy. I have a test unit on my bench but there seems to be a lot more to do on the software before its ready for general use. I would use Arduino but my programming skills are pretty much non existent.
Last edited by budman1758 on 05 Oct 2022, 17:53, edited 1 time in total.
"The glass is twice as big as it needs to be".

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Hall sensor and ESP32

#5 Post by TD-er » 05 Oct 2022, 17:49

OK, that use case does look very frightening to me.

Hand brakes are something that should not be automated and upto 15-ish years ago those were forbidden in Europe as far as I know.
If memory serves me well, Renault was the first to make a car with an electric hand brake and I'm still convinced that should never have been allowed. Not sure if there are other brands who have implemented electric hand brakes, nor if Renault even has those in their current models.

Apart from the obvious reasons why you should not automate these, let's assume you would.
Detecting whether it was pulled "far enough" can't be quantified by just measuring the current, nor whether you may have pulled it up far enough.
When I use the hand brake (which is rarely needed in the Netherlands) I always check by releasing the foot brake to see if it will move and if not, I will have to pull it harder.
That's some logic which can't be implemented by simply measuring the current or whether some end stop was reached as it does depend on a lot of factors like how steep the ground is, weight of the vehicle, wear and tear of the hand brake, etc.

So please reconsider whether you want to go on with this, as I would not like to see anyone get hurt by some truck that's moving without someone at the wheel.

User avatar
budman1758
Normal user
Posts: 301
Joined: 15 Apr 2017, 05:13
Location: Riverside CA USA

Re: Hall sensor and ESP32

#6 Post by budman1758 » 05 Oct 2022, 18:13

TD-er wrote: 05 Oct 2022, 17:49 OK, that use case does look very frightening to me.
So please reconsider whether you want to go on with this, as I would not like to see anyone get hurt by some truck that's moving without someone at the wheel.
The truck has an automatic trans that has a park function also. I drove this truck around for 25 years without a parking brake. lol
As I said this is an experiment. The actuator will either pull the cable far enough to work or it won't. If not, then I will stick with the hand lever.
My grand daughter has a Volkswagen that has a push-button parking brake. So they are not unheard of.

I think the current sensing way will probably be more accurate than reading distance traveled. We shall see.

EDIT:
Found that motor plugin.
"The glass is twice as big as it needs to be".

Ruprecht
Normal user
Posts: 18
Joined: 04 Nov 2016, 10:02
Location: im Süden von DE

Re: Hall sensor and ESP32

#7 Post by Ruprecht » 06 Oct 2022, 09:59

First of all: Apart from safety considerations, here in Germany the "TÜV" would withdraw the license for road traffic at the next main inspection because of an "inadmissible technical change".

Regarding the technical aspect: The description of the linear motor clearly states that the Hall sensor supplies impulses which could be counted and converted into the motor position:

"FEEDBACK: Hall Effect - Each pulse represents 0.007046 inches (0.17896mm)"

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Hall sensor and ESP32

#8 Post by TD-er » 06 Oct 2022, 10:04

I simply overlooked the "Hall sensor" part... perhaps a bit 'blinded' by the reason I already mentioned.

But the Hall sensor is just like a pulse, so it is exactly what was intended for the PWM motor plugin I mentioned.

Post Reply

Who is online

Users browsing this forum: No registered users and 26 guests