E-Chopper (ex. Expectations & Torque)

I have been at work.
I'm still trying to find another gear in place of the stock 9-tooth.
Undeterred, I have been busily engaged at fabricating the deck for the motor to sit on.
Maybe this'll chuck a wobbly at motor trial, unanticipated torsional forces wreaking havoc. I'll have to wait till then. Seems sturdy, but what do I know.

You can see three pictures of what I've wrought so far ? Photobucket | Make your memories fun!

So, if I just go for broke in order to get this show on the road and go with the stock sprocket (9t on the motor sprocket and 20t on the wheel sprocket)...

I won't have a controller as such, I'm figuring on just hitting it with the battery voltage, leaded out to a terminal, I guess, fat-wire in hand, touching on/off, as needed.

Would that be awful? Inappropriate?

      • Dumb? * * *
        Remember, it's the "1/2 hp" 24V

Nice progress :slight_smile:

I know a guy who just used a on/off toggle switch to control his e-bike. If he wanted to go slow, he just did a manual PWM. I don't know the voltage or power of the motor, but I do know he had to beef up the bike wheel because going instantly from full stop to max torque tended to bend the spokes.

Thanks, John_S. That's something I did not anticipate.
I'm going to slap together something rudimentary for control, and keep things arduinofied, which shouldn't be a big deal esp. since I don't have to go power backwards with it and it'll be better having it to go slow with to rough in the motor/sprocket alignments.

I have a length of new chain and a new chain tool, too. This should be interesting.

If you don't want to implement a speed controller from scratch, you may want to try a Chinese eScooter ESC like one of these:
http://www.ebay.co.uk/itm/ws/eBayISAPI.dll?ViewItem&item=220606285127.
I bought two of these for my RC lawn mower project. They are quite cheap and easy to use. You can buy a throttle handle that works with the controller. The control voltage is 1-4V so they are easy to use with the Arduino also. I drive mine from the Arduino's analog out. I put a low pass filter between the analog out pin and the controller because I assumed that the controller expects clean control voltage and Arduino's analog out is really PWM.

I'll guess you can find similar ESCs also from the US ebay.

OK, I have a preliminary test version of a motor controller. Two MOSFETs in parallel (on the perfboard).
First time through it was OK with 12V, when I switched over to 24V it biffed right way [Poof!] Drain to Gate short x 2. But, I didn't use a clamping (commutation) diode. When I re-built it I did use one and it's performing well.
So, as far as I am concerned, that MOSFET zener-equivalent diode is not suitable as a clamping diode.
Next step - mount it on the deck with the chain on, get some load on it.

  • And, yes,.. I'll have to buy some better spec'd FETs or parallel more of these (2, 3?).

This coming Monday is our Memorial Day holiday, so I'm taking off Friday and the following Tuesday to work on this more.

Power mosfets typically have avalanche energy ratings, which are given on the datasheet. The avalanche energy rating is much lower than you will get from a 350W motor. Maybe OK for a relay. Also, absorbing the back emf as avalanche energy is less efficient than using a commutating diode because of the higher voltage, which will cause the current to drop faster, increasing the power consumption (the extra power ends up as heat in the mosfet). So you should always use a commutating diode (preferably a Schottky one) when using a mosfet to PWM a motor or other inductive load.

Dear Mr Pancake!

I am doing almost the same project, but with a 36v 800W motor, for my sons gocart. If you could draw up a diagram of how you wired it and what components you used, I'd be very grateful!
I already ordered some suitable mosfets and diodes that were recommended in another thread, just not sure how to wire them up...

Thanks in advance,

Magnus, Sweden

OK.
Here is the circuit as used in the demo (previous)

Those FETs are under-rated, as I posted. That's why I used two; as long as my draw stays under 20A life is good. I have ordered better rated FETs and driver ICs, so the circuit will stay the same but for the addition of the driver IC between the gates and the PWM pin.

The demo just ramps up through several levels, good enough for my test purpose. I have a manual step up/down programme still under test.

Anyway, that's what I have so far.

Thank you very much!

I will be using dual 600v 50Amp mosfets, only expecting to need a total of 30Amps.

KR
Magnus

OK, I have mounted the motor to the deck and I have the chain on.

I did a test with my new button circuit and the mechanicals all seem good, but my circuit and/or 'sketch' is not 100% +.

Each button goes to hardware debouncing (4093s) and then to respective input pins. The debounced outputs also get diode-OR'd into the hardware interrupt pin.
I suppose I ought to wring it out better on the bench with an LED.
It's like it's not hitting with each button click. The X button works without fail, but the Accel and Decel skip sometimes or don't register.
Maybe it's my buttons.
It's my first time with an Interrupt. My 'sketch' follows, feel free to make constructive criticism.

byte speed_idx = 0;      //
byte currentLevel = 0;   // comparison
byte newLevel = 0;       // comparison
byte Accel_Btn = 4;      // alias - Accelerate btn
byte Decel_Btn = 5;      // alias - Decelerate btn
byte Zeropwr = 6;        // alias - "kill" button
byte motorpin = 11;      // pin alias, PWM to gate/MOT
byte Level [6] = {0,20,40,100,175,250};
boolean Detect = false;  // Interrupt Note 

void setup()
{
  pinMode(motorpin, OUTPUT);
  pinMode(Zeropwr, INPUT);
  pinMode(Accel_Btn, INPUT);
  pinMode(Decel_Btn, INPUT);
  //Serial.begin(9600);
  attachInterrupt(0,Activity,RISING);  // Ext_Int on D2
}

void loop()
{
  if (Detect == true)
  {
    Decode();
  }
  if (currentLevel != newLevel)
  {
    analogWrite(motorpin,Level[speed_idx]);
    currentLevel = newLevel;
  }
}

void Activity()   // this is the Interrupt !
{
  Detect = true;
}

void Decode()
{
  Detect = false;          // clear out "Detect"
  if (digitalRead(Zeropwr) == HIGH)
  {
    speed_idx = 0;
    newLevel = 0;
    //Serial.print((newLevel),DEC);
  }
  else if (digitalRead(Accel_Btn) == HIGH)
  {
    Accelerate();
  }
  else  // Activity detected wasn't Zeropwr or Accel_Btn
  {
    Decelerate();   // default = (A' & Z')
  }
} 

void Accelerate()
{  
  if (speed_idx < 5)
  { 
    speed_idx ++;
  }
  newLevel = Level[speed_idx];
  //Serial.print((newLevel),DEC);
}

void Decelerate()
{
  if (speed_idx >= 1)
  {
    speed_idx --;
  }
  newLevel = Level[speed_idx];
  //Serial.print((newLevel),DEC);
}

Got it!
It was in my void Decode ()
Whereas I had

  if (digitalRead(Zeropwr) == HIGH)
  {
    speed_idx = 0;
    newLevel = 0;
  }
  else if (digitalRead(Accel_Btn) == HIGH)
  {
    Accelerate();
  }
  else
  {
    Decelerate();
  }

that last else needed to be an else if (too)

  if (digitalRead(Zeropwr) == HIGH)
  {
    speed_idx = 0;
    newLevel = 0;
  }
  else if (digitalRead(Accel_Btn) == HIGH)
  {
    Accelerate();
  }
  else if (digitalReal(Decel_Btn) == HIGH)
  {
    Decelerate();
  }

Much better - no skipping.
I started looking at Keypad.h[/b], but that takes up 7 pins.

It Works !! It Works !!

It's hard to tell from the video, but I have the batteries and the electronics box in an insulated lunch-bag hung around my neck.
I was running with those IRLZ14's, but they smoked ("breathe deep the gathering gloom, watch lights fade from every room...") when I tried taking off from a dead-stop. I forgot to put in the 220? resistors. As the FETs' failure mode was, once again, Drain-to-Gate short ("You cannot be serious!"), with naught between it and 24V...good ol' D11 went to "Pin Heaven".
I replaced those Z14's with some STP40NF10L's. I didn't try accelerating from a dead-stop because I really wanted to go for a ride - which I did (thank you very much.) I can look into that stall current stuff later.

It sounds a nice project!

The 220R/2k2 resistors form a voltage divider that reduces the gate drive voltage by 9% and hence increases Rds(on). I would ditch the 2k2 resistors and use instead a single resistor of 2k2 or 10K from the Arduino output pin to ground.

I replaced those Z14's with some STP40NF10L's.

That's one of my favourite mosfets, however the Rds(on) is a little high for the current you are switching. I would go for something with Rds(on) less than 10 milliohms, maybe http://www.newark.com/jsp/search/productdetail.jsp?sku=70R7958.

Each button goes to hardware debouncing (4093s) and then to respective input pins. The debounced outputs also get diode-OR'd into the hardware interrupt pin.

Way over-complicated IMO, it's very easy to poll the buttons and debounce them in software - but if it works, no reason not to keep it.

dc42:
It sounds a nice project!

The 220R/2k2 resistors form a voltage divider that reduces the gate drive voltage by 9% and hence increases Rds(on). I would ditch the 2k2 resistors and use instead a single resistor of 2k2 or 10K from the Arduino output pin to ground.

Thanks, dc42!
When I re-built the FET circuit, I replaced the 2K with 20K? (I have a long strip of those.) As a matter of fact, I got those STP's based on a recommendation of yours to another member. I think I need to keep the 220?, in case the FETs crater again (nasty business that). I might give the wholly unassisted acceleration from a dead-stop test another go, but right now I'm having fun.

Yes, you need to keep the 220 ohm resistors. What I was suggesting was to move the 2K2 resistors to the other end of them - and then use just one resistor to ground since there is no point in having 2 in parallel.

dc42:
Yes, you need to keep the 220 ohm resistors. What I was suggesting was to move the 2K2 resistors to the other end of them - and then use just one resistor to ground since there is no point in having 2 in parallel.

O-I-C... that way, there wouldn't be a divider.
OK.

I rigged up a battery tray using a baking pan. It's pretty flimsy and flexes (too much) despite my "reinforcements". But it's more casual than having the batteries around my neck, riding is more enjoyable this way. I went about for around 4 miles and kind of went all free-style like in an empty parking lot this morning.