Hall effect sensors

I am looking to upgrade a project I built last year. The project involved modifying an elliptical cross trainer to control the playback speed of an MP3 being played on a Raspberry Pi.

It was done with some custom python code and a hall effect sensor.

I am now looking to do the same thing with a real bike. But the use of a ‘normal’ bike means that I am looking to use the standard spoke-mounted magnet from a bike computer kit. The one I have needs to be within a few millimetres of the sensor.

If the sensor I am currently using is one of these:
https://components101.com/a3144-hall-effect-sensor

Am I right in assuming it should be possible to get a more-sensitive sensor, rather than trying to mount a stronger magnet to the spoke? If so, which one would be recommended?

Thanks

Hi Michael,

That sounds like a pretty neat project!

I’ve taken a look at the datasheet on the product page you linked to:

Looks like you need something with a B_op of less than 70 Gauss. I’d suggest using one of these:


And here’s the relevant section from the datasheet:

You could also just use stronger magnets, or move them closer. I’d also suggest considering adding multiple magnets evenly spaced around the wheel to improve your system’s sensitivity to acceleration.

Regards,
Oliver
Support | Core Electronics

1 Like

Thank for the reply. I’ve been a bit distracted since my initial post.

I stopped past and had a look at the bike (before Melbourne went into lockdown) and this seems like the simplest approach. We tried another magnet that was lying around the workshop and it increased the range to a couple of centimetres.

A single magnet worked fine last time. In fact, the biggest problem was that it worked too well. Whenever we were testing it, we were just going at a ‘normal’ speed. Once we loaded the real music, and started hitting higher speeds, we found that the speed suddenly halved. It took me an embarrassingly long time to realise that I had left in a debounce value on the code that monitored the GPIO. Once I removed that, it worked perfectly.

The elliptical cross trainer caused an irregular rhythm, which won’t be an issue with the circular wheel on the bike.

This is the cross trainer in action:

I am actually thinking about using the Pi to control an RGB LED strip, linking the colour of the LEDs to the speed of the wheel. Any advice on which components would be needed to control 2-3M of 5050 RGB LEDs from the Pi? It is my understanding that a MOSFET transistor for each of the colours is what I need. But the making sense of the specs/maths to work out which part(s) will be able to handle it is I bit beyond me.

Hi Michael,

That’s awesome, Spicks and Specs is great!

I’d suggest taking a look at the Adafruit and Sparkfun tutorials on their Analogue LED strips (These have a V+ bus, and separate ground lines so you can use N channel MOSFETs):

https://learn.sparkfun.com/tutorials/non-addressable-rgb-led-strip-hookup-guide/all

If you just want to run it indoors, we’ve got some cheap strip from DFRobot:

Here’s a good example on doing it with a Pi and Python:

If you’re after fancy chasing effects, you’ll need to use Addressable LEDs (Adafruit call them Neopixels) - we’ve got a good tutorial on those:

Regards,
Oliver
Support | Core Electronics

@Oliver, thanks for the reply.

I picked up some 5050 RGB LEDs last week. Just waiting on the MOSFETs (I think the IRLZ44N is capable of doing what I need) to arrive.

I have a few Wemos D1 Mini boards floating around. I will probably test it out with a some of the single colour stips I have lying around. Since I’m using a Pi, I will tend to stick with PWM for that side of things. Most of my Wemos projects have been based around OpenMQTTGateway. But I am not sure if it will support PWM. If it doesn, it will be easy to extend my existing Google AIY functionality.

I’ve got a never-ending supply of 12V and 5V supplies, so that side of things will be easily covered. I may look at running a buck converter to make it possible to stick with a single power source.

It is also likely the light rope from last year with be used again, meaning there is nothing I need to do from my end.

Agains, thanks for your help.

Hi Michael,

No worries. There should definitely be a way to get it working - it’s definitely possible to control PWM on an ESP8266 remotely:

Good luck with it!

Regards,
Oliver
Support | Core Electronics

The rejigged bike setup is now up and running. Only a few software variables to nail down. We needed 3 magnets to improve the detection of a sudden stop in pedalling.

I am currently using the sensor that Jaycar sell as part of their “PCduino” range. It is a clone of the Arduino module. It is currently using a 2m cable run. I was hoping to run a 10m cable between the Pi and the sensor. Since it operates at 4.5V-24V, will voltage drop be an issue for either the module or GPIO side of things?

Would switching the sensor out for one of these overcome any such issue?

Hey Michael,

That’ll be majorly dependant on the gauge and resistance from the material of the wire being used. Your best bet in this case would be to experiment with it and see what your materials will let you get away with. If there’s anything else that we can do for you please let us know!

Bryce
Core Electronics | Support

Unfortunately the cable was bought back when Masters was shutting down and only has “4 CORE SECURITY CABLE” printed on the sheath.

As best I can tell, it is basically this. Unless the colours have changed and what I bought as Red/White/Black/Green is now sold as Red/White/Black/Blue.

That is basically what I ended up doing. I have about 12-13m of it left. I pulled out the dupont crimper and put connecters on each end. The 5v module appears to be working fine over that length.

I’ll try build a mock-up of the setup and get a video. Much like the previous build, the new incarnation is not really something that look at all Pi-like in the flesh. You would have to tear it down to ever see the Pi.

1 Like

For those following along at home, the first recording session was last Wednesday and everything went off without a hitch. To extend the sensor cable, the guys in tech services cut the cable and attached a couple of XLR connectors. This allowed for the use of an XLR-connected extension lead to give the additional length.

The extra length meant that the Pi was located in the off-stage area, where I operated it from. This saved running power / USB / HDMI / audio cables out onto the set.

1 Like

Hi Michael,

Nice solution! Any word on when the episode is going to air?

Regards,
Oliver
Support | Core Electronics

I don’t have any details on transmission dates. I think there is still one more of the last round of episodes to go to air (the 2010s special). I didn’t even hang around long enough to find out who won the episode I was there for :slight_smile:

It was easier to just pack up and leave as soon as my segment was finished. It is simpler to just head to my car at 8pm and avoid having to explain to any police what I was doing out of my house.

2 Likes