watt meter all functions (diy)

Awesome thread.

Now to monitor the state of each lipo cell and if over 4.2 volts, dump it to a shunt resistor.
Sorry, got ahead of myself.

Love the thread man.

Would you consider a LVC function? Not sure how you would implement that so simply?
Just out of interest would you consider fabbing one and sending it to Australia for payment? I'm been thinking of 3d printing a housing and magnetically attaching it to a Direct Mount DH stem for one of my custom builds...
 
Samd said:
Just out of interest would you consider fabbing one and sending it to Australia for payment? I'm been thinking of 3d printing a housing and magnetically attaching it to a Direct Mount DH stem for one of my custom builds...
there is "nothing" to fab. it's really really simple. if you can handle a soldering iron you can do it yourself quite easily. it just needs the parts connected together. no big deal.
i did it with a breadboard and jumpers to see if everything works. then you can replace the jumpers with soldered wires and you're done.
 
Correct. But I'm busy assembling frames.
I have made bits with an arduino before.

But if someone wants to load the code onto a nano, assemble the bits and charge me for their time I'd pay for it.
 
Samd said:
But if someone wants to load the code onto a nano, assemble the bits and charge me for their time I'd pay for it.
i could easily do it, but i'm not sure of the form factor wanted. if you just need the watt meter funtionality it's the arduino nano, the "amp meter" and the display. there may be some spare parts left which i ordered as backup. maybe i can build one for you.
 
The throttle thread and this one are fascinating. I read the interest in having this hardware/software be used as a complete controller and Ca device. Given a reasonable set of functions, can a solution be built from this approach? Can a single board serve both as an ESC and brain for taking inputs and sending power to the motor?

I've been searching for some time and have yet to find a single board device that can accept sufficient inputs to feed the logic to provide optimal signal to the motor. Optimal means different output based on the desired profile. Highest efficiency for max distance. Highest speed or maximum torque for low speed steep inclines.

Typical instrumentation functions would also be coded and display and record logs for later use.

It would be unreal if this "experiment" could evolve into a full function and feature solution. Not only would it be far cheaper than a purchased ESC and CA but also far more flexible to each setup.

Subscribed!
 
I don't think there would be enough processing power ( or outputs/inputs ) in to cover everything that would be required,, but it would be very easy and cheap to use 2 arduino's and sync them together so you can have a dedicated arduino just dealing with the motor speed, regen and current limiting and use the other arduino to do everything else.

i know this is very basic but it may be worth having a play with : http://www.instructables.com/id/BLDC-Motor-Control-with-Arduino-salvaged-HD-motor/?ALLSTEPS

edit : just hunting around for some more examples and I also found this http://elabz.com/bldc-motor-with-arduino-circuit-and-software/
 
gwhy! said:
I don't think there would be enough processing power ( or outputs/inputs ) in to cover everything that would be required,, but it would be very easy and cheap to use 2 arduino's and sync them together so you can have a dedicated arduino just dealing with the motor speed, regen and current limiting and use the other arduino to do everything else.

https://www.sparkfun.com/products/11723


Muxx the i/o ports?
 
A mux will slow things down even more, and for a esc you will need all the processing power that the arduino can provide, but having said that it would depend on what your esc requirements are.
 
Not sure if it helps, but there's a thread I started
http://www.endless-sphere.com/forums/viewtopic.php?f=2&t=61997 for an appnote/chip that does multiple A/D conversions at the same time (intended for phase sampling for precision motor control). Would that help or am I completley missing hte problem? :oops:
 
The instructable article references chips designed to control BLDC for commercial use. Companies like Microchip and ATMEL offer excellent app notes, documentation, and support in general to understand and utilize their chips. Parallax and PIC preceded Arduino in the hobbyist field but I suspect the commercial chipsets have vast libraries of code to utilize for our rather simple applications.

With all the tremendous talent here used to build incredible mechanical works it still makes me wonder why there has not been more innovation on the control and software side.

If the processors might get overloaded serving all functions than it makes sense to use two systems and they would need only simple interfacing. One board can handle the motor sensor and control functions. The other would primarily serve the instrumentation functions for display and logging, reading sensors, and passing some control or sensor values to the motor control unit. Not totally clear which functions would be best placed but it would likely fall out naturally as the design took shape. Something like the hall sensor would seem best paired with the motor control and things like heat sensing might better reside on the second chip then send signal to the MC (motor control) to attenuate thresholds or alter power curves, etc.
 
So how would one go about programming remaining distance averaging momentary power use on Arduino? Is it complicated? I am no programmer but that would be great to have as AH says nothing to average consumer.
 
windtrader said:
The instructable article references chips designed to control BLDC for commercial use. Companies like Microchip and ATMEL offer excellent app notes, documentation, and support in general to understand and utilize their chips. Parallax and PIC preceded Arduino in the hobbyist field but I suspect the commercial chipsets have vast libraries of code to utilize for our rather simple applications.

With all the tremendous talent here used to build incredible mechanical works it still makes me wonder why there has not been more innovation on the control and software side.

If the processors might get overloaded serving all functions than it makes sense to use two systems and they would need only simple interfacing. One board can handle the motor sensor and control functions. The other would primarily serve the instrumentation functions for display and logging, reading sensors, and passing some control or sensor values to the motor control unit. Not totally clear which functions would be best placed but it would likely fall out naturally as the design took shape. Something like the hall sensor would seem best paired with the motor control and things like heat sensing might better reside on the second chip then send signal to the MC (motor control) to attenuate thresholds or alter power curves, etc.


Its all worth playing with :).

agniusm said:
So how would one go about programming remaining distance averaging momentary power use on Arduino? Is it complicated? I am no programmer but that would be great to have as AH says nothing to average consumer.

I haven't put much thought into this but first you will have to incorporate a od meter then you can have a base line distance for your battery pack and use averaging to approx distance left in pack using ah's used and distance traveled.. in short should be pretty easy to incorporate..

pendragon8000 said:
This current sensor is the right one?
I want to use regen on the sentilon 100amp controller
Cheers
http://au.element14.com/jsp/search/productdetail.jsp?sku=2057428

yes you can use that sensor as it will fit straight into the code , but if you have a 100A controller then you would be better off getting a 100A sensor.. it will make it a little more accurate but you will have to change one of the parameters in the code that is posted for it to read and limit at the predicted current.
 
gwhy! said:
pendragon8000 said:
This current sensor is the right one?
I want to use regen on the sentilon 100amp controller
Cheers
http://au.element14.com/jsp/search/productdetail.jsp?sku=2057428

yes you can use that sensor as it will fit straight into the code , but if you have a 100A controller then you would be better off getting a 100A sensor.. it will make it a little more accurate but you will have to change one of the parameters in the code that is posted for it to read and limit at the predicted current.
Excelent, I really apriciate your help. I hope running sensorless isnt going to be an issue for me, i have a pretty high torque gear ratio 17.8:1 so im hoping it will be ok.

with a NTC thermistor in/on the motor and a 60mm 5v fan on the controller as well it shoud be fairly safe (I hope)

I'm good with code so should be able to suss that amp mod no problem.
 
with the 2 thick connectors at the top looking at it face on the battery side is on the right and the controller side is the left .

3 small leads are (left to right) +5v, 0v, sig/out
 
gwhy! said:
with the 2 thick connectors at the top looking at it face on the battery side is on the right and the controller side is the left .

3 small leads are (left to right) +5v, 0v, sig/out
Awsome .
Thanks for your help.

Oh so that's positive battery, positive controller I'm guessing.
 
Here is a routine to smooth/rolling average a rawADC value ...
Code:
const int numReadings 10 //smoothing averages last 10 readings from current pin
float Isensor_Average = 0.0;
float totalI = 0.0;                  // current ( I ) running total
int readingsI[numReadings];      // setup the array for current readings 
int index = 0;                  // index of array for the current reading


//***************************************************************************************
void average() 
{ 
  ISsensor = analogRead(ISsensor_Input_pin);  // read from ISsensor
  totalI= totalI - readingsI[index];     // subtract the last reading:    
  readingsI[index] = Isensor; // add last ADC reading to next index point in the array
  totalI= totalI + readingsI[index];    // add the reading to the total:    
  Isensor_Average = totalI / numReadings;  // calculate the average current:       
  index = index+1;     // advance to the next position in the array:      
  if (index >= 10)  index = 0;// ...wrap around to the beginning:

}
//***************************************************************************************


This is a alternative way to get the current value from the sensor .. its a lot easier to understand..

Code:
//------------------------------------------------------------------------------
void loop() 
{
 Current = fmap(Isensor_Average,ISensor_zero,1023,0.000,220.000); // these are the values for a 200U sensor, the 220.000 is the actual value that the sensor can read even that its advertised as a 200A sensor
}
//------------------------------------------------------------------------------

 
 //  fmap function routine  ------------------------------
float fmap(float x, float in_min, float in_max, float out_min, float out_max)
{
 return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}
 //--------------------------------------------------------
 
Back
Top