zeropoints active mag bearing

jeremy gwilt

zeropoints active mag bearing
« on January 3rd, 2017, 12:33 PM »Last edited on January 3rd, 2017, 12:39 PM
95% of late night mistakes corrected......

ive got the circuit layout down to 3 jumpers.

much work left to do, including trim pots for gauss cut-offs (and...well....all the soldering...)
rough sketch:

i
Code: [Select]
nt hallpin1 = A3;
int hallpin2 = A4;
int coil1 = 9;
int coil2 = 10;
void setup() {
 
  pinMode(coil1,OUTPUT);
  pinMode(coil2,OUTPUT);
 
}

void loop() {
 
 

  float gauss1 = analogRead(hallpin1);
 
  float gauss2 = analogRead(hallpin2);
 
 
 
  if (gauss1 >= 629) {
    digitalWrite(coil1,LOW);
    digitalWrite(coil2,HIGH);
  }
  else {
  digitalWrite(coil1,HIGH);
  }
 
  if (gauss2 <= 387) {
    digitalWrite(coil2,LOW);
    digitalWrite(coil1,HIGH);
  }
  else {
  digitalWrite(coil2,HIGH);
  }
;

}

incase anyone can actually read anything here (ill make a better drawing once it hits final stages):

Q1+Q3 2N2222
Q2+Q4 IRFD9024
C1 25v220uf
C2+C3 not sure
R2+R4 not sure
all pots are 10K
D1+D2 1N4007
U1+U2 CD4046
Arduino Nano

a couple early crappy vids


https://www.youtube.com/watch?v=KtrFF_jdWbw


https://www.youtube.com/watch?v=Mg_uGF-3Vhc

most annoying sound ever


https://www.youtube.com/watch?v=ElbtTYFYWMA

 IMG_0009.JPG - 2618.7 kB, 4000x3000, viewed 24 times.


~Russ

Re: zeropoints active mag bearing
« Reply #3, on January 3rd, 2017, 02:25 PM »
this is a fun and cool project, the idea behind using a push push mode is key.

what magnets do i need to make this?

thanks for publishing this!

~Russ

Lynx

Re: zeropoints active mag bearing
« Reply #4, on January 3rd, 2017, 09:33 PM »
Interesting, many thanks :thumbsup:

Diadon

Re: zeropoints active mag bearing
« Reply #5, on January 4th, 2017, 06:47 AM »
Good share and very interesting setup. Thanks my friend :)

jeremy gwilt

Re: zeropoints active mag bearing
« Reply #6, on January 6th, 2017, 06:23 PM »
thanks guys.
the board is finished, and as expected....adding two more analogRead (for trim pots) lagged the nano down a little much. it still works, but higher frequency is better for sure.
im looking at overclocking options, etc but im pretty sure ive got what i wanted form this project so far.
i still hate these perf boards.....gee, it would be nice to have someone in the community that could whip off custom circuitboards.....(wink, wink)

 IMG_0012.JPG - 3319.26 kB, 4000x3000, viewed 17 times.

Re: zeropoints active mag bearing
« Reply #7, on January 7th, 2017, 03:08 PM »
ok, this is pretty much final code.....and it is functioning at 9v input, roughly 240mA (so a new 9v battery should power the whole thing just fine)

Code: [Select]
int hallpin1 = A6;
int hallpin2 = A5;
int trim1 = A0;
int trim2 = A3;
int coil1 = 8;
int coil2 = 10;

void setup() {
 
  pinMode(coil1,OUTPUT);
  pinMode(coil2,OUTPUT);
 
  }

void loop() {
 
  float tweak1 = analogRead(trim1);
 
  float tweak2 = analogRead(trim2);
 
  float gauss1 = (analogRead(hallpin1)+(tweak1/50));
 
  float gauss2 = (analogRead(hallpin2)+(tweak2/50));
 
  if (gauss1 >= 637) {
    digitalWrite(coil2,LOW);
    digitalWrite(coil1,HIGH);
  }
  else {
  digitalWrite(coil2,HIGH);
  }
 
  if (gauss2 <= 402) {
    digitalWrite(coil1,LOW);
    digitalWrite(coil2,HIGH);
  }
  else {
  digitalWrite(coil1,HIGH);
  }

}