This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
drive questions.
#11
(2022-03-25, 08:51 PM)johnm Wrote:
(2022-03-24, 01:11 AM)seandepagnier Wrote: The newest motor.ino codes support pwm on the clutch output, and the duty cycle is configurable in the pypilot settings.   So it does apply full power to the clutch for a few hundred milliseconds, but after reduces to pwm with set duty cycle to drop power.

Sean

Good to hear you have pwm clutch in the new motor.ino :-)
Searching found your post with this:
pypilot_client servo.clutch_pwm=50
if pypilot is running
if not running edit ~/.pypilot/pypilot.conf

Does pypilot need to be updated  for this to work?
Is that percent or with respect to 255 on full?

Looking at the photo of the new motor controller in your store I do not see clutch output.
Is it on the board or is the $8 clutch option external?

John
I am very happy today, I managed to get the clucth to work. I built a small board (mosfet) with the information you gave me. The only problem is that I have to use Timo Birnschein's motor.ino and modify it a bit by Andreas29. Pin 11 is not defined in the motor.ino. I use ''ENGAGE_LED_PIN 7 // led is on when engaged'' to engage the clutch. So I don't have access to the PI function for pin 11. I also can't confirm if the different servo settings are calibratable.  
I tried to change pin 7 of the motor.ino for pin 11 in pins.have a definition but it doesn't work, it doesn't change state. What do you think? What should I do to use the latest motor.ino and not have badvoltage_fault? Or use Timo's motor.ino with pin11? or not? or use the last one?
Also if I use the latest motor.ino, I get a badvoltage error because Andreas' design board probably does not use the same resistor for shuts! and even if I disable the current sensor. 
I tried to change pin 7 of the .ino motor to pin 11 in pin.h but it doesn't work, it doesn't change state.     
What do you think? What should I do to use the latest .ino motor and not have badvoltage_fault?  Or use the timo motor.ino with pin11?
I think the driver will be usable in this configuration.
Small video attached sorry for my bad english https://1drv.ms/v/s!AqRtiecG3vcx0Svc-gNGaBm3OX7-
Thanks for your help

Translated with www.DeepL.com/Translator (free version)
Pierre 
Reply
#12
(2022-03-25, 08:51 PM)johnm Wrote: Good to hear you have pwm clutch in the new motor.ino :-)
Searching found your post with this:
pypilot_client servo.clutch_pwm=50
if pypilot is running
if not running edit ~/.pypilot/pypilot.conf

Does pypilot need to be updated  for this to work?
Is that percent or with respect to 255 on full?uty
It is from 0-100% duty cycle. By default of 50% will reduce power a lot already. You may have to adjust it more to get the lowest power consumption and still have enough to hold the clutch on.
Quote:Looking at the photo of the new motor controller in your store I do not see clutch output.
Is it on the board or is the $8 clutch option external?
It has clutch output on the board, but the mosfet and fuse are not populated unless that option is selected.


(2022-03-25, 10:46 PM)NousVoila Wrote: I am very happy today, I managed to get the clucth to work. I built a small board (mosfet) with the information you gave me. The only problem is that I have to use Timo Birnschein's motor.ino and modify it a bit by Andreas29. Pin 11 is not defined in the motor.ino. I use ''ENGAGE_LED_PIN 7 // led is on when engaged'' to engage the clutch. So I don't have access to the PI function for pin 11. I also can't confirm if the different servo settings are calibratable.  
I tried to change pin 7 of the motor.ino for pin 11 in pins.have a definition but it doesn't work, it doesn't change state. What do you think? What should I do to use the latest motor.ino and not have badvoltage_fault? Or use Timo's motor.ino with pin11? or not? or use the last one?
By default led is pin 13, for my motor.ino sketch.

For the led, it will show when commanded/engaged but there is no duty cycle to reduce power consumption to the clutch.
Quote:I tried to change pin 7 of the .ino motor to pin 11 in pin.h but it doesn't work, it doesn't change state.     
What do you think? What should I do to use the latest .ino motor and not have badvoltage_fault?  Or use the timo motor.ino with pin11?
I think the driver will be usable in this configuration.
It uses pwm output. It seems with ibt2 you must set pwm_mode = 2.

For my schematics and scripts, pin 7 is an input end stop for port end of travel... so it would not work for output of anything.

If you want pwm output it needs to be pin 11 because it uses hardware pwm. For on/off only of clutch you can likely wire other pins and modify the code.
Reply
#13
(2022-03-25, 10:46 PM)NousVoila Wrote: I am very happy today, I managed to get the clucth to work. I built a small board (mosfet) with the information you gave me. The only problem is that I have to use Timo Birnschein's motor.ino and modify it a bit by Andreas29. Pin 11 is not defined in the motor.ino. I use ''ENGAGE_LED_PIN 7 // led is on when engaged'' to engage the clutch. So I don't have access to the PI function for pin 11. I also can't confirm if the different servo settings are calibratable.  
I tried to change pin 7 of the motor.ino for pin 11 in pins.have a definition but it doesn't work, it doesn't change state. What do you think? What should I do to use the latest motor.ino and not have badvoltage_fault? Or use Timo's motor.ino with pin11? or not? or use the last one?
Also if I use the latest motor.ino, I get a badvoltage error because Andreas' design board probably does not use the same resistor for shuts! and even if I disable the current sensor. 
I tried to change pin 7 of the .ino motor to pin 11 in pin.h but it doesn't work, it doesn't change state.     
What do you think? What should I do to use the latest .ino motor and not have badvoltage_fault?  Or use the timo motor.ino with pin11?
I think the driver will be usable in this configuration.
Small video attached sorry for my bad english https://1drv.ms/v/s!AqRtiecG3vcx0Svc-gNGaBm3OX7-
Thanks for your help
As Sean says if you want pwm need to use pin 11.
It will also pull in clutch while motor is running in standby mode.
As I recall soldered wire directly to Arduino pin on the motor controller pcb.  Use small stranded wire and try to provide some sort of strain relief. Maybe a dab of silicone. Was not that happy with solution but it is working. That's why I'm asking questions about the new motor controller :-)
If you really want to use another pin I have schematic and program to use tiny85 to do pwm. 


I'd try to get the new motor.ino using pin11 to work but you may have to make some changes.
I'm using a cheap rudder position indicator. Works fine but was challenging to install.
Reply
#14
(2022-03-26, 03:57 PM)johnm Wrote:
(2022-03-25, 10:46 PM)NousVoila Wrote: I am very happy today, I managed to get the clucth to work. I built a small board (mosfet) with the information you gave me. The only problem is that I have to use Timo Birnschein's motor.ino and modify it a bit by Andreas29. Pin 11 is not defined in the motor.ino. I use ''ENGAGE_LED_PIN 7 // led is on when engaged'' to engage the clutch. So I don't have access to the PI function for pin 11. I also can't confirm if the different servo settings are calibratable.  
I tried to change pin 7 of the motor.ino for pin 11 in pins.have a definition but it doesn't work, it doesn't change state. What do you think? What should I do to use the latest motor.ino and not have badvoltage_fault? Or use Timo's motor.ino with pin11? or not? or use the last one?
Also if I use the latest motor.ino, I get a badvoltage error because Andreas' design board probably does not use the same resistor for shuts! and even if I disable the current sensor. 
I tried to change pin 7 of the .ino motor to pin 11 in pin.h but it doesn't work, it doesn't change state.     
What do you think? What should I do to use the latest .ino motor and not have badvoltage_fault?  Or use the timo motor.ino with pin11?
I think the driver will be usable in this configuration.
Small video attached sorry for my bad english https://1drv.ms/v/s!AqRtiecG3vcx0Svc-gNGaBm3OX7-
Thanks for your help
As Sean says if you want pwm need to use pin 11.
It will also pull in clutch while motor is running in standby mode.
As I recall soldered wire directly to Arduino pin on the motor controller pcb.  Use small stranded wire and try to provide some sort of strain relief. Maybe a dab of silicone. Was not that happy with solution but it is working. That's why I'm asking questions about the new motor controller :-)
If you really want to use another pin I have schematic and program to use tiny85 to do pwm. 


I'd try to get the new motor.ino using pin11 to work but you may have to make some changes.
I'm using a cheap rudder position indicator. Works fine but was challenging to install.

Thank you very much for your help. I'm starting to understand a little bit the electronic principle of the PMV.
I use pi zero 2 with img from Selian and motor.ino from Andreasw29 everything works fine but pin 11 is not used.
If I use the last ino on Github I get a badvoltage_fault.
I tried disabling the current direction but I still have a bad voltage.
I know that the mosfet I made works fine and pwm_mode = 2.
1st solution : program the ino of Andréas to use pin 11
2nd solution : program Sean's ino to not have bad voltage it's probably more complicated because I think that the shunts are not electronically designed in the same way
Sch from Andeasw29
https://github.com/AndreasW29/pypilot-ti...otmain.pdf

Arduino sketch : https://github.com/AndreasW29/pypilot-ti...controller

What would you do?
Johnm, I would try your sketch and a program to use tiny85 to make pwm.




Translated with www.DeepL.com/Translator (free version)
Pierre
Pierre 
Reply
#15
(2022-03-27, 05:02 PM)NousVoila Wrote: Thank you very much for your help. I'm starting to understand a little bit the electronic principle of the PMV.
I use pi zero 2 with img from Selian and motor.ino from Andreasw29 everything works fine but pin 11 is not used.
If I use the last ino on Github I get a badvoltage_fault.
I tried disabling the current direction but I still have a bad voltage.
I know that the mosfet I made works fine and pwm_mode = 2.
1st solution : program the ino of Andréas to use pin 11
2nd solution : program Sean's ino to not have bad voltage it's probably more complicated because I think that the shunts are not electronically designed in the same way
Sch from Andeasw29
https://github.com/AndreasW29/pypilot-ti...otmain.pdf

Arduino sketch : https://github.com/AndreasW29/pypilot-ti...controller

What would you do?
Johnm, I would try your sketch and a program to use tiny85 to make pwm.
No matter what if you use the motor controller you have you will have to do a bit of work.
At least some programing work..

I'd try solution2 first.
It's been a year since I worked on it  so sorry if I'm not right on.
To get motor.ino to do pwm had to free up timer2 to  run clutch and use timer0 for what timer2 was used for.
I'd do a diff between new motor.ini and the version the hardware is designed for.
Because of the change in timers you will see a lot of changes that you can ignore.
Also as I recall Sean has some grounded pins that are used as switches to determine  which code to use. May have to force mode changes in the code if not set properly..
I found it challenging to understand the code since it access the registers on the counter timers directly.
Have done it before but that was over 30 years ago.

In case you want to resort to external pwm attached schematic and code.
Should have fuse in output connected to the mosfet.
Can use the circuit your using now for the mosfet.
clutch output from motor controller goes to pint 2 of attiny85.
jP1 is esp programing socket. You can get some inexpensive programmers for attiny85.
My current setup has the clutch output from the motor controller go to pin 1 of the programing socket, effectively bypassing the attiny85.
.

Program is below.
It's pretty simple.
Used platformio. It's c++ but pretty sure it will pass as .ino
Full on delay is about  100ms.
pwm is about 30%.

..............................................................................................
#include <Arduino.h>
#include <avr/wdt.h>
int8_t clutch_pin=1;
int8_t clutch_in_pin=3;
uint8_t clutch_level=78;
int8_t clutch_on_time=90;
int8_t clutch_state=0; //0=off 1 on 2 pwm
unsigned long clutch_pwm_time;
int8_t clutch_input=0;
int8_t led=4;
void clutch_on()
{
  clutch_state=1;
  digitalWrite(clutch_pin, HIGH);
  clutch_pwm_time = millis() + clutch_on_time;
}

void clutch_pwm()
{
  clutch_state=2;
  analogWrite(clutch_pin,clutch_level);
 }
void clutch_off()
{
  clutch_state=0;
  digitalWrite(clutch_pin, LOW);
}
void setup()
{
  // initialize LED digital pin as an output.
  wdt_enable(WDTO_2S);
  pinMode(clutch_in_pin, INPUT);
  pinMode(clutch_pin, OUTPUT);
  pinMode(led, OUTPUT);
  clutch_off();
}


void loop()
{   
    wdt_reset();
    clutch_input=digitalRead(clutch_in_pin);
    //clutch_input=HIGH;
    //digitalWrite(led, HIGH);
    if (clutch_input == LOW)
    {
       if (clutch_state > 0)
       {
          clutch_off();
          digitalWrite(led, LOW);
      }
    }
    else  // input HIGH
    { digitalWrite(led, HIGH);
        if (clutch_state==0)
        {
           clutch_on();
           digitalWrite(led, HIGH);
        }
    }
     
        
    if (  clutch_state==1  )
    {
        if (millis() > clutch_pwm_time)
        {
           clutch_pwm();
        }
        
    }
   
}

..............................................................................................................


Attached Files
.pdf   clutch.pdf (Size: 33.92 KB / Downloads: 124)
Reply
#16
You can use analog write on an external attiny, sure.. but if you try that in the main motor.ino it will potentially have issues. Always let us know what works!

In any case... bad voltage is nothing to do with current measurement shunt. It is voltage measurement. You will see on the schematic:
https://pypilot.org/schematics/hbridge_controller.pdf

A0 has 10k and 560 ohm resistor. You just need to add these. bad voltage ensures it stops the motor if the voltage is too low or high (avoid damage, also useful as it beeps if your battery voltage is way off...)

Anyway... you can also check the source code to motor.ino and modify/disable it to avoid this quite easily as well.
Reply
#17
(2022-03-27, 07:32 PM)seandepagnier Wrote: You can use analog write on an external attiny, sure.. but if you try that in the main motor.ino it will potentially have issues.   Always let us know what works!

In any case...   bad voltage is nothing to do with current measurement shunt.   It is voltage measurement.    You will see on the schematic:
https://pypilot.org/schematics/hbridge_controller.pdf

A0 has 10k and 560 ohm resistor.   You just need to add these.   bad voltage ensures it stops the motor if the voltage is too low or high (avoid damage, also useful as it beeps if your battery voltage is way off...)

Anyway...  you can also check the source code to motor.ino and modify/disable it to avoid this quite easily as well.
Sean, I changed the following code to no longer have BADVOLTAGE fault.
        if(volts <= 900 || volts >= max_voltage) {
            //disengage();
            flags &= ~BADVOLTAGE_FAULT;
        } else
            flags &= ~BADVOLTAGE_FAULT;
I plugged my daughter board (mosfet) on pin 11 but it doesn't work.
I'm sure my daughter board is good because if I connect on the ENGAGE_LED_PIN 7 in the motor.ino of Andreasw29 I have a constant amperage and the clutch works
Pierre 
Reply
#18
did you use my sketch:

https://github.com/pypilot/pypilot/blob/.../motor.ino


It uses pin 11 for clutch.. however it uses a lower frequency pwm for the regular motor controllers as they dont have a mosfet driver for the clutch mosfet...

You may need to study the code and compare differences more since you are using your own hardware. Would be nice if you did get it working with my sketch to know the exact differences so it can be integrated somehow.
Reply
#19
(2022-03-30, 03:07 AM)seandepagnier Wrote: did you use my sketch:

https://github.com/pypilot/pypilot/blob/.../motor.ino


It uses pin 11 for clutch.. however it uses a lower frequency pwm for the regular motor controllers as they dont have a mosfet driver for the clutch mosfet...

You may need to study the code and compare differences more since you are using your own hardware.  Would be nice if you did get it working with my sketch to know the exact differences so it can be integrated somehow.

Yes, I tried your sketch but I have to uncheck this condition to not have badvoltage_fault :
if(volts <= 900 || volts >= max_voltage) {
            clear();
            flags |= BADVOLTAGE_FAULT ;
        } other
            flags &= ~BADVOLTAGE_FAULT ;

I have connected my daughter board with my mosfet assembly according to the following scheme (controler mod)and it doesn't work

And if I use your clutch sketch (Your controler), it works
Q4 = ?? which mosfet type N  


Could it be that your schech clutch is for electric cylinders where the clutch is a friction clutch. I believe, but need to check, that the clutch on my hydraulic cylinder is a knife gate valve; it is either open or closed. I'll get back to you after checking. I'll get back to you after checking. And if it is, I don't need the radiometry from tinypilot?
Pierre 


Translated with www.DeepL.com/Translator (free version)


Attached Files Image(s)
       
Pierre 
Reply
#20
For a version without the mpc1416 gate driver, check the schematic:

https://pypilot.org/schematics/wp_controller.pdf
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)