Re: PID control

120 views
Skip to first unread message

John Schmotzer

unread,
May 3, 2013, 1:10:47 PM5/3/13
to ioio-...@googlegroups.com
Ideally you are going to need to update the IOIO firmware to run the closed loop control on the processor, typically you do not close a loop around bluetooth communication........

another consideration is to use an arduino to do the closed loop control, and then use the IOIO as the means to set the Arduino loop reference


On Fri, May 3, 2013 at 11:34 AM, Ilight network <ilight....@gmail.com> wrote:
hello ! 
i'm using ioio board now on controlling lighting using buck converter and i wanna control pwm using feedback pid control using ioio ? any ideas plz 

--
You received this message because you are subscribed to the Google Groups "ioio-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ioio-users+...@googlegroups.com.
To post to this group, send email to ioio-...@googlegroups.com.
Visit this group at http://groups.google.com/group/ioio-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
John W. Schmotzer
Electrical Engineering: Systems
MSAE Exec Board
HKN Active
University of Michigan

ilight

unread,
May 4, 2013, 5:54:55 AM5/4/13
to ioio-...@googlegroups.com
thanks a lot for your reply , so if i wanna use closed loop i won't use bluetooth ....plz can u suggest me any feedforward control method instead of feedback that can ease this or it can't be ? 


John Schmotzer

unread,
May 4, 2013, 3:54:10 PM5/4/13
to ioio-...@googlegroups.com

Maybe i dont understand what you are doing, if u are just controlling lighting with pwm and have a stable DC Voltage, you can directly adjust light level by switching the duty cycle. Id imagine you could do that easily with the ioio

On May 4, 2013 5:55 AM, "ilight" <ilight....@gmail.com> wrote:
thanks a lot for your reply , so if i wanna use closed loop i won't use bluetooth ....plz can u suggest me any feedforward control method instead of feedback that can ease this or it can't be ? 


Tux Leonard

unread,
May 4, 2013, 4:21:06 PM5/4/13
to ioio-...@googlegroups.com
Could you describe your feedback loop a little bit more in detail?
If your signal changes fast (1ms loop) and you are not allowed to miss any loop then you need to do it in ioio-firmware. 
Slower loops (100-1000ms and more) you can do in Java on your android device. 



2013/5/4 John Schmotzer <schmotz...@gmail.com>

Ytai Ben-Tsvi

unread,
May 8, 2013, 8:24:28 PM5/8/13
to ioio-...@googlegroups.com
I've successfully implemented a PID loop at 200Hz using OpenAccessory.
But yeah, the original post doesn't contain enough information to give a useful answer.

Tux Leonard

unread,
May 9, 2013, 8:52:50 AM5/9/13
to ioio-...@googlegroups.com
Didn't you miss some lopps at this speed (5ms)? 
Was this the balancing robot project?
If got no experiance with the garbage collector on android and the delay introduced by USB.


2013/5/9 Ytai Ben-Tsvi <yta...@gmail.com>

Ytai Ben-Tsvi

unread,
May 9, 2013, 11:55:28 AM5/9/13
to ioio-...@googlegroups.com
It was the self-balancer indeed. I don't think I was missing cycles, at least not by a lot. I didn't rigorously tested this, since once it works, it works :)

ilight

unread,
May 10, 2013, 7:39:52 AM5/10/13
to ioio-...@googlegroups.com
thanks alot guys for your help , i decided to perform the closed loop on the buck and use hbridge with the pwm after it to get out of this problem , what i wanted before to implement current control feed back using ioio which will take 2 loops and i don't know how to do this using ioio since i need bluetooth in my project too . any way iam facing this problem in pwm that it the pulse width changes right but after couple of periods there's few zeros then it goes right then zeros . i don't know why this zeros appears i tried setdutycycle and setpulsewidth but same thing ! 
any help plz 

ilight

unread,
May 10, 2013, 8:00:58 AM5/10/13
to ioio-...@googlegroups.com
iam using :
public void setup() throws ConnectionLostException {
try {

pwmOutput1_ = ioio_.openPwmOutput(new DigitalOutput.Spec(11,Mode.OPEN_DRAIN), 1000);
 
pwmOutput2_ = ioio_.openPwmOutput(new DigitalOutput.Spec(12,Mode.OPEN_DRAIN), 1000);
enableUi(true);
} catch (ConnectionLostException e) {
enableUi(false);
throw e;
}
}
public void loop() throws ConnectionLostException {
try {
while(true){
if (OnOff_1.isChecked()) {

pwmOutput1_.setDutyCycle(seeking11.getProgress()/1000.0f);

} else {

//not sure from this 
pwmOutput1_.setDutyCycle(0);

}

Tux Leonard

unread,
May 10, 2013, 2:50:42 PM5/10/13
to ioio-...@googlegroups.com
What havens when you use a constatnt value (0.5) instead of seeking11.getProgress()/1000.0f in the call to pwmOutput1_.setDutyCycle()?

Do you get any exceptions in your program?


2013/5/10 ilight <ilight....@gmail.com>

ilight

unread,
May 10, 2013, 3:27:20 PM5/10/13
to ioio-...@googlegroups.com
i have zeros too cause i have another automatic function like this 

if (read.isChecked()) {
pwmOutput1_.setDutyCycle(0.8f);
pwmOutput2_.setDutyCycle(0.8f);
} else {
pwmOutput1_.setDutyCycle(0);
pwmOutput2_.setDutyCycle(0);
and it also gives zero gaps 


Tux Leonard

unread,
May 11, 2013, 3:01:38 AM5/11/13
to ioio-...@googlegroups.com
What do you mean by "zero gaps"?
How do you measure this zero gaps? Oszi? Could you attach a picture?

Just to clarify:
A PWM signal consists of High and Low sections in a special ratio (duty cycle). You are not talking about this Low sections as  "zero gaps". 

Are you sure that your program doesn't hit the else branch setting the duty cycle to zero.


2013/5/10 ilight <ilight....@gmail.com>

ilight

unread,
May 11, 2013, 9:44:28 AM5/11/13
to ioio-...@googlegroups.com
gaps between the regular periods that if i'm having 1ms period with 30% on and 70 % ,for example it keeps showing for 3ms then for 4ms there's zeros only then the period repeat itself again and this changes irregularly too.i don't know why this zeros kept coming .

thanks a lot everyone

Tux Leonard

unread,
May 11, 2013, 4:12:02 PM5/11/13
to ioio-...@googlegroups.com
How do you measure this values? Please provide a picture of your measurements.

Do you have a stable power supply?
Do you have a short-cut on the PWM output? 
Some shematics/pictures would be helpfull.


2013/5/11 ilight <ilight....@gmail.com>
gaps between the regular periods that if i'm having 1ms period with 30% on and 70 % ,for example it keeps showing for 3ms then for 4ms there's zeros only then the period repeat itself again and this changes irregularly too.i don't know why this zeros kept coming .

thanks a lot everyone

--

Ytai Ben-Tsvi

unread,
May 11, 2013, 10:01:38 PM5/11/13
to ioio-...@googlegroups.com
Let's please close this thread. The question has been answered on the other thread and it is merely an application bug.
Reply all
Reply to author
Forward
0 new messages