Hello!
Wondering if anyone has worked with hall effect sensors with magnets on a wheel with Bela? I have a stationary bike and i want to detect start, stop, direction and speed using a hall effect sensor and then use that data in a PD patch to trigger different sounds and have the playback speed of those sounds controlled by the speed + direction of the wheels. Curious if anyone has tutorials or advice on how to do this?

i have done this, but with a couple of reed switches as sensors (so just 0/1 on digital inputs).
i should think it's the same principle.

mounted the sensors next to one another along the travel of the magnet, and used the time difference of the two to determine direction.

oh, also very important: i ended up with six magnets around the wheel, iirc.
note that the diameter of the wheel was rather small, so you may be able to place even more before detection zones start to overlap. in any case, more magnets = more resolution and faster response.

to give you an example: for speed calculations, you need to know how much time passed between two pulses, so you need to have detected two magnets to even start calculations. starting from a standstill, and using only one magnet, that means at least one full revolution and then some to see that same magnet twice. with 6 magnets, that is reduced to a movement of only 60 degrees.

detecting 'start' is not a problem, magnet present = go 🙂
detecting 'stop' is another matter.
i found i needed to determine what the slowest possible speed would be, aka maximum time between two pulses to still perform a speed calculation with.
anything longer than that is regarded as 'not moving', so when the pulse timer hit that number without a new magnet detection, only then the 'stop' got activated. clearly that introduced some lag, so it became a matter of finding the right balance between response time, slowest possible speed and a controlled stop.
with the 'stop' function active, playback speed would ramp to zero, tape-style. this effect also kind of masked the lag, and it feels pretty natural.

i can see if i can upload some pix/vid when i'm on a better i'net connection, if you're interested.

  • amd replied to this.

    btw, this was a production job for an art piece, so i don't really feel at liberty to share the whole patch.
    feel free to ask questions though.

    Remork Sure, please send pix and vid. Would love to check that out. Thank you for sharing your project, I have been working in a similar direction. I actually started this project using IR sensors, but i think that the hall effect sensors will work better. Currently i have the wheel of the bike painted a matte black and have put a strip of aluminum foil on a section of the wheel. I have code that determines when the bike is started and stopped b.c of this IR sensor - i employed similar logic to do the stop function, but mine does have that lag, so i love the tape effect using the ramp. will try this to blur the lag. so the issue with the IR sensor is the resolution is low so at fast speeds it doesn't seem to work well. Also, it's not as practical to get another ir sensor involved to do the backwards/forwards sensing. .... so my other thought is that since the ir sensor is hooked to the bela via digipin 11 and then ground and power, I should be able to just 'sub' in the hall effect sensor and then work with the data coming into bela for calculations? ir sensor sends HI / LOW like the hall effect sensor. I think I'm ok with the pure data patch part, but i just want to check how you did the magnets and hall sensor set up? is there a specific location/angle of the hall sensors? the type of magnets? best location for sensor and magnets... I ordered cylindrical magnets to create a ring shape and a few US1881 latching hall sensors.