Hall Effect Sensor

Question, the output from the potentiometer is in ohms, can it be replaced by a hall effect sensor with the output in volts without additional components?

@Jan The output of the potentiometer is not “ohms”, a potentiometer is a voltage divider that needs an input voltage e.g. 5V and through the varying resistance of the potentiometer you get a range of output voltage from 0V to 5V, so its in the end the same deal as with a linear hall sensor.

1 Like

Thanks Benjo that explains it all.

Thanks everyone, that sums it up very well! appreciate the help.

Now to learn coding the Arduino :slight_smile:

http://efoil.builders/t/diy-waterproof-remote/108/224?u=mab
Check some examples here, the whole tread is packed of great info!

1 Like

the thread below has lot of information and some code example.

using the same sensor that @Benjo mentioned.

since then it evolved a lot:

  • Still using the same 315mhz transmitter receiver and arduino based receiver.
  • I’m using 2 sensors, one for the trigger, and one for the wheel.
  • the trigger has a single magnet that you can see on the picture below and the wheel has 2.
  • the “mechanical” part with the wheel and trigger mechanism will flood, and the sensors are on the electronic chassis that slides inside.
  • the only opening to the chassis is at the bottom (easy to waterproof)
  • I have now 3 different modes that you pick when the remote starts:
    • if after turning on you press the trigger, the wheel is not activated, and only the trigger controls speed
    • if after turning on you push the wheel up, the trigger act as a dead man and the wheel accelerates when you push up or slowdown when you push down
    • if after turning on you push the wheel down, the trigger act as a dead man and the wheel accelerates when you push down or slowdown when you push up. (i might change that mode to have the wheel position determine the speed instead of the acceleration)

The blue band on it contain a magnet to switch the remote on with the reed switch inside.
There are 3 very bright LEDs (to still be visible under the sun) that indicate the remote is starting, which mode was chosen and finally what speed is it set at.

i’ll upload the code and share the Fusion file tonight.

6 Likes

Great remote, simple and effective looking design.

Do you have to seal the threaded cap with an oring?

@Mat that is a wicked remote design! simple and effective.

The amount of useful stuff everyone learns on this forum is amazing it totally puts school to shame. (except for learning about Shakespeare in english of course :wink: )

heres the remote I’ve been working on, similar to others, the trigger section is flooded, while the electronics section is sealed.

1 Like

The thread is already quite watertight by itself, some thick grease could do the trick i guess, but i think i’ll used a round flat piece of silicon foam dropped in the cap.

Below is the fusion file:
The trigger and wheel are held with piece of 1/4 inch aluminum tube.
and the slot at the top needs to be filled with transparent silicon.
Body and Body12 need to be acetone glued (if your plastic permits) it’s way better printed in 2 parts.

and this is the code i’m now using:
it’s dirty, but works fine… i got lazy to write something clean to make the leds blink when the mode is confirmed at the end of the setup. And the debugging lines are still in.
Also note, it doesn’t self calibrate yet… so when the hall sensors are glued, they might be in a slightly different position and the code is to account for it.


***** transmitter CODE *****

#include <RH_ASK.h>
#include <SPI.h> // Not actually used but needed to compile

RH_ASK driver(5000, 0, 1 );

int led1pin = 5;
int led2pin = 6;
int led3pin = 3;
int tpin=0;
int wpin=1;
int vitesse = 0;
int wheel;
int wheelm;
int led1 =0;
int led2 =0;
int led3 =0;
int mode=0;

void setup() {
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
pinMode(led3, OUTPUT);
Serial.begin(9600);

if (!driver.init())
Serial.println(“init failed”);

int lx=0;
int x=0;
for (x = 0; x < 5000; x ++) {

lx= lx+1;

if( lx>765 ){
lx=0;
}

led1= constrain(lx,0,255);
led2= constrain(lx-255,0,255);
led3= constrain(lx-510,0,255);
analogWrite(led1pin,led1);
analogWrite(led2pin,led2);
analogWrite(led3pin,led3);
int sensw = analogRead(wpin);
int senst = analogRead(tpin);

if (sensw > 800 ){
mode=1;
analogWrite(led2pin,0);
analogWrite(led3pin,0);
analogWrite(led1pin,255);
delay(500);
analogWrite(led1pin,0);
delay(500);
analogWrite(led1pin,255);
delay(500);
analogWrite(led1pin,0);
delay(500);
break;
}
if (sensw <300 ){
mode=2;
analogWrite(led1pin,0);
analogWrite(led3pin,0);
analogWrite(led2pin,255);
delay(500);
analogWrite(led2pin,0);
delay(500);
analogWrite(led2pin,255);
delay(500);
analogWrite(led2pin,0);
delay(500);
break;
}
if (senst < 300 ){
mode=3;
analogWrite(led1pin,0);
analogWrite(led2pin,0);
analogWrite(led3pin,255);
delay(500);
analogWrite(led3pin,0);
delay(500);
analogWrite(led3pin,255);
delay(500);
analogWrite(led3pin,0);
delay(500);
break;
}
Serial.print(“x”);
Serial.print(x);
Serial.print(“lx”);
Serial.print(lx);
Serial.println();
delay(1);
}

}

void loop() {

int trigger = analogRead(tpin); //480 to 200

if ( mode == 1 || mode == 2 ){

if (trigger<=300){

wheel=analogRead(wpin); // 30 to 1000

if (mode==1){
wheelm=map(wheel,30, 1000, -10, 10);
vitesse = vitesse + wheelm;
}
if (mode==2){
wheelm=map(wheel,30, 1000, 10, -10);
vitesse = vitesse + wheelm;
}

if (vitesse < 5 ) {
vitesse = 5;
}
if (vitesse > 255 ) {
vitesse = 255;
}

}

else{
vitesse = 0;
}
}

if(mode==3){
vitesse = constrain(map(trigger, 480, 200, 0, 255), 0, 255);
}

led1= constrain(vitesse * 3 ,0,255);
led2= constrain(vitesse * 3-255,0,255);
led3= constrain(vitesse * 3-510,0,255);
analogWrite(led1pin,led1);
analogWrite(led2pin,led2);
analogWrite(led3pin,led3);

uint8_t values[1];
values[0]=(uint8_t) vitesse;
driver.send(values, 1);
driver.waitPacketSent();

delay(2);

Serial.print(“trigger:”);
Serial.print(trigger);
Serial.print(“wheel”);
Serial.print(wheel);
Serial.print(“wheelm”);
Serial.print(wheelm);
Serial.print(“vitesse”);
Serial.print(vitesse);
Serial.print(“mode”);
Serial.print(mode);
Serial.println();

}


***** RECEIVER CODE *****

#include <RH_ASK.h>
#include <SPI.h> // Not actually used but needed to compile
#include <SoftwareServo.h>

RH_ASK driver(5000, 0, 1 );

SoftwareServo esc;

int SERVO_LOW = 0;
int SERVO_HIGH = 180;
int c1,c2,c3;
int v1=0;

unsigned long lastM;
unsigned long currentT;
int ledPin=4;

void setup() {

pinMode(ledPin,OUTPUT);
esc.attach(3);

Serial.begin(9600);
if (!driver.init())
Serial.println(“init failed”);
}

void loop() {

uint8_t buf[4];
uint8_t buflen = sizeof(buf);

esc.refresh();

if (driver.recv(buf, &buflen))
{
c1 = buf[0];
lastM = millis();
v1 = map(c1, 0, 255, SERVO_LOW, SERVO_HIGH);
digitalWrite(ledPin,HIGH);
}
esc.write(v1);
esc.refresh();
delay(50);

currentT = millis();

if((unsigned long)(currentT-lastM) > 1000 )
{
esc.write(0);
digitalWrite(ledPin,LOW);

esc.refresh();
v1=0;

}
Serial.print(" v1:");
Serial.print(v1);
Serial.print(" currentT:");
Serial.print(currentT);
Serial.print(" lastM:");
Serial.println(lastM);
Serial.print(" c1:");
Serial.println(c1);
}

3 Likes

Mat can you post a video of the remote mode working? Being an hall sdnsor trigger, a min/max read calibration set up, when turning on the remote would be useful, just a few lines of code to ensure you utilize the whole range of throttle over the whole trigger excursion each time.
Another add on, to receiver, that simplifies beginners and not only life, will be accelleration soft ramp. I couldn’t get 315MHz module to dialogate properly, I had an hex code reading from the receiver…then I gave up in favor of NRF24 again, but it’s interesting!

I need to stabilize the on/off first (the reed switch has a strange behavior sometime… like sticking close when trying to turn off), i might add a calibration time, but it will be painful at each restart. Hard coding the coefficients in the remote after the sensors are installed should be enough, as the wheel only uses 10 steps and and down out of 1024 values…

The soft ramp is handled by the remote in the modes using the wheel, but not for the trigger, i think i’ll modify the code there on the remote side.

I like to keep the receiver as direct as possible to not mess with the safety: if it looses communication for more than 1 second, it stops the motor…

The big discovery i made this time is the constrain() function… soooo usefull!

The 315Mhz module gives me a 0-255 value, easy to use, and precise enough. You might not have been using the right library. i like the tolerance it gives when you go underwater a bit…

Below are the video of modes 1 and 3.
I use a servo to test the signal coming out of the receiver.
The blue light turning on on the receiver is to say that it’s connected to the remote.

that’s mode 1: trigger only

and that’s mode 3: wheel up to accelerate

1 Like

Whoa!! Ok, now I got it, cool! Reed sensor: check the datasheet, max current value. I took two types we yse at work on boat windlasses for chain meter counter device, one did the same as yours, as soon as transmission started, ut struggled to turn off, the other (Hamlin brand, more “brittle” but better quality), still working, switching on an off immediately. It’s rated 500mA at rather high voltage (don’t remember but multiple of 5V I use). I love your ring solution!

That’s great Mat, it’s awesome that you implemented trigger control and an easy to use and safe cruise control. Solid effort!

I think it would be great if we could have a battery voltage displayed on the remote, this shouldn’t be to hard to make work with a small LCD screen.

Or even easier for simplicity, implementing some code into the receiver that turns a bright row of LEDS down as the voltage decreases would be good, as it would be easy to see while riding, and would be easier than a 2 way communication between remote and receiver.

Anyone know of a voltage sensor for arduino that can read 50v?

Voltage divider with two resistors, for example 47k and 4k7 or 10k and 1k in series.

1 Like

Yes, that information would be useful, but it would require to switch to Bluetooth instead of the transmitters i’m using. Mine only go one direction, the remote has a transmitter only, and the board only a receiver.
I plan on having the display of the voltage / remaining capacity on the board as it’s not necessarily something you need every few seconds :slight_smile:

How did you wire your Hall effect sensor to the motherboard

Simple question- How do I save this Fusion 360 file? I have F360 on an Apple and a PC. Can’t figure it out on either one… :unamused:

that should work …

1 Like

Thank You,I got them printed out.

Hi mat, i tried to download your remote files from fusion360, they look great but it didn’t work. I guess they changed the account rules. If you could upload the files to thinginverse or somewhere, i’d be really grateful!