DIY Electric Car Forums banner

Arduino Software

7461 Views 13 Replies 8 Participants Last post by  Dave Koller
Anyone familiar with the C like language of arduino? I am currently using it for my microcontroller and could really use some help with the over current protection part of it
Code:
 int potPin = 2;    // select the input pin for the potentiometer
    int ledPin = 11;   // note onlly 5,6, 9,10,11 are PWM
    int wait = 0;     // variable to store the value coming from the sensor


    void setup() {
   //   Serial.begin(9600);
    pinMode(ledPin, OUTPUT);  // declare the ledPin as an OUTPUT
    }

    void loop() {
    wait = analogRead(potPin) - 28; // read the value from the sensor
    if(wait > 950){
      digitalWrite(ledPin, LOW);
    }else{
       digitalWrite(ledPin, HIGH); // turn the ledPin on
       delayMicroseconds(1023 - wait); // stop the program for some time
       digitalWrite(ledPin, LOW); // turn the ledPin off
       delayMicroseconds( wait); // stop the program for some time
    }
   //   Serial.println( wait );
    }
What I have so far is very rudimentary and I currently have this lem current sensor LEM LF306S LF 306-S 300A. When I put a magnet near it and print out values on a serial print line it read 1023 the maximum for arduino. Anyone on the forum ever work with arduino or know anyone who has written programs for motor controllers with it before?
1 - 1 of 14 Posts
Current control for torque only really applies to AC controllers.
Nope. Works the same for all motor types I know of, including series wound. Increase current and you'll increase the torque, no black magic involved.

Then again, it may have some benefit in a DC setup with speed feedback.
Na, it just complicates things. :D

Tesseract or Qer may have some insight into this.
Not much that hasn't been said already. The AVR is powerful enough to run a DC-controller and it's a reasonably simple little microcontroller to understand and write safe code for if you know what you're doing. There's a lot of code on the net to study and there's the avrfreaks-forum that's usually very friendly and useful if you run into problems.

Constructing the power electronics' gonna be a bitch though. Not that it's theoretically complicated, but in real life weird things start to happen when you try to harness high power. Going for tens of kW, like in a golf cart controller, isn't very hard (and that's why those controllers aren't very expensive) but when you aim at hundreds of kW or the glorious MW you'll start to blow things up. A lot. See the threads about constructing the ReVolt in the Ecomodders forum or the Soliton 1 here. They have one thing in common, they blew up a lot of transistors in the prototype runs...

Combining software and hardware is gonna make things even more interesting. A small software error can easily blow up a few hundred dollars or more (been there, done that) a hardware problem is likely to blow up more or less all of the electronics (at least the expensive parts, Tesseract knows all about that from empirical experience) and in the end building your own controller from scratch and just making a single one is probably going to be more expensive than you think.

I've seen a few people boost here in the forum that they're gonna build their own controllers. In most cases we hear a lot about it until they start to run tests and blow up their first set of transistors, then they usually give up and go quiet. A few do actually finish their controllers, but that's usually guys that (excuse me if I'm blunt here) do have experience from similar constructions already so they're not getting stuck at the basics.

Personally I think you have two realistic options:

  1. Go for ReVolt and help improving that controller rather than trying to reinvent the wheel.
  2. Buy something that's been proven to be reliable and spend your energy at converting a car rather than blowing up silicon.
There's a reason it took EVnetics a year to literally blow up all the obstacles on the path to a sellable product, you know...
See less See more
1 - 1 of 14 Posts
This is an older thread, you may not receive a response, and could be reviving an old thread. Please consider creating a new thread.
Top