Flex+Scicos+Erika !!!

Forum related to the FLEX boards

Moderator: paolo.gai

desmomito
Newbie
Posts: 27
Joined: Wed Mar 05, 2008 4:03 pm

Flex+Scicos+Erika !!!

Post by desmomito » Thu May 15, 2008 3:33 pm

Hi,
I\'d like to know more informations about the Flex+Scicos+Erika integration. I\'ll develop, using Flex Full board, three controllers for an hydraulic system using the Scicos code generator. I have the following questions in my mind :

1) When I use the Scicos code generator, does it use Erika RTOS routines ?

2) I need to design three controller running in the Flex board at different sampling times. Is it possible to manage the multi-tasking in Scicos ? Which is the best way ?

3) I\'ve seen that the Flex Full has got inside a power supply (switching) which adapts the different voltage levels. Is it possible to use those voltage levels as output ? For example if a voltage level was 5V I\'ll happy to use it as power input for a optocoupler.

Thank you,
Pasquale.

paolo.gai
Administrator
Posts: 875
Joined: Thu Dec 07, 2006 12:11 pm

Re:Flex+Scicos+Erika !!!

Post by paolo.gai » Thu May 15, 2008 6:55 pm

Hi!

Here are some answers:

1) Yes... the ERIKA Kernel is used every time you compile code generated from Scilab. Please take a look at the files

\\examples\\pic30\\pic30_scicos\\

That is the template with ID \"board_flex\" which is used as default by the code generator.



2) It is not yet possible to generate out-of-the-box multirate systems using the Scilab code generator, but it will be probably soon.

A way to obtain that is to generate three separated superblocks, which do not interact. Then you have to generate the code and manually assemble them.

For now the only thing supported out of the box are single rate systems.

3) Of course you can, depending of course from the kind of load you are putting on... the switching power supply has a maximum current which can be supplied! . In any case, take a look at the schematics you find on the FLEX CD-ROM. There you\'ll find the pinout of the connectors, which have GND and V+ pins you can use.

Regards,

Paolo

desmomito
Newbie
Posts: 27
Joined: Wed Mar 05, 2008 4:03 pm

Re:Flex+Scicos+Erika !!!

Post by desmomito » Thu May 15, 2008 8:08 pm

Thank you very much.
I\'ll follow your suggestion for the multi-tasking procedure. I\'ve seen the schematics and I think it depends on the LM2574 which is able to guarantee 0.5A as output current. So I think the maximum current which can be supplied is 0.5A. Is it correct ?


Thank you,
Pasquale.

francesco
Newbie
Posts: 18
Joined: Mon Mar 03, 2008 1:07 pm

Re:Flex+Scicos+Erika !!!

Post by francesco » Fri May 16, 2008 4:14 pm

Hi,

you are right, the maximum current that the LM2574 can provide is 0.5. You can use the +5V as well as the +3.3V provided by the switching regulator of flex full if you are going to power low power electronic components such as digital components (digital ports, optocouplers, ecc).

If you are going to power many devices, using the internal switching regulator, please make a rough calculation of the global power consumption. I strongly recommend you not to go beyond 0.3 A (flex does not have a thermal dissipator).

If you want to power servomotors or other \"power\" devices I suggest to use instead the +Vout pin (using also GND_OUT) with an additional regulator (i.e. LM7805 for servo). In this case you can power many other electronic devices depending on wich power supply you are using (the limitation in this case is your power supply and the regulator that you add).

Ciao,
Francesco.

desmomito
Newbie
Posts: 27
Joined: Wed Mar 05, 2008 4:03 pm

Re:Flex+Scicos+Erika !!!

Post by desmomito » Sun May 18, 2008 5:37 pm

Ok,
thank you very much. I\'m gonna do a rough calculation about the current I need for the 5V devices but I think I won\'t have more than 0.1A.

What about a load of 12V-3A ? Do you think I can use the V_OUT and GND_OUT pins ?

What about having a common ground with all the devices (5V, 3.3V and 12V) ?

I\'m trying to understand how to connect the Flex and my power PCB which has different voltage devices.


Thank you,
Pasquale.

francesco
Newbie
Posts: 18
Joined: Mon Mar 03, 2008 1:07 pm

Re:Flex+Scicos+Erika !!!

Post by francesco » Mon May 19, 2008 10:09 am

thank you very much. I\'m gonna do a rough calculation about the current I need for the 5V devices but I think I won\'t have more than 0.1A.

... ok

What about a load of 12V-3A ? Do you think I can use the V_OUT and GND_OUT pins ?

Unfortunately the V_OUT passes through the rectifier diodes, so you can not go over 1A of continuous current over the 1N4007. If you have to power devices that have current peaks of more than 3A the V_OUT will be ok but if the load drains 3A continuously this could damage the rectifier diodes. If you use a 12V power supply and the V_OUT remember that the V_OUT will be around 10.5V so you will have to use at least a 13V power supply.

I suggest you to use one high current power supply for Flex and your electronics ( using the +V and gnd terminal of your power supply for powering separately your electronics and Flex). Then you can use optocouplers for using the digital signals of Flex. The optocouplers will allow you to use different voltages for your electronic side.

Ciao,

Francesco.

desmomito
Newbie
Posts: 27
Joined: Wed Mar 05, 2008 4:03 pm

Re:Flex+Scicos+Erika !!!

Post by desmomito » Mon May 19, 2008 11:16 am

I suggest you to use one high current power supply for Flex and your electronics ( using the +V and gnd terminal of your power supply for powering separately your electronics and Flex).

...ok

Then you can use optocouplers for using the digital signals of Flex. The optocouplers will allow you to use different voltages for your electronic side.

What do you mean exactly ? Even if I use the 12V as power supply for the Flex and my power curcuit separatly, can I still use the 5V and 3.3V from the Flex for my digital devices ? Or it\'s better to use linear regulator direclty in my power circuit to obtain the 5V and 3.3V ?

The ground reference will be the same in any case (my power circuit, Flex, dsPIC etc..) ? I need to generate a PWM output is it that the low level is 0V and the high level 3.3V ?

Than you,
Pasquale.

francesco
Newbie
Posts: 18
Joined: Mon Mar 03, 2008 1:07 pm

Re:Flex+Scicos+Erika !!!

Post by francesco » Mon May 19, 2008 12:22 pm

Even if I use the 12V as power supply for the Flex and my power curcuit separatly, can I still use the 5V and 3.3V from the Flex for my digital devices ?

No, because you will have a different ground reference. Like an example, if you use the PWM output of the Flex board (0-3.3V) you will have less than 3.3V on your electronic because of the rectifier diode (GND_alim is different to GND_OUT). The gnd reference is not the same.

As a solution you can generate the PWM from Flex and than you have two solution:

1- Use the V_OUT and GND_OUT. In this case you do not have problems in terms of voltage references and so on and you can use directly the PWM to drive you electronics (I think that this can be a digital low-power IC) and use the V_OUT,GND_OUT for the power stage of your circuit.

2- Use the V_alim and GND_alim. In this case you will need an additional regulator (i.e. LD1117 3.3V). Your reference will be GND_alim so you will have to use a fast optocoupler to keep the isolation between the GND of the two circuits (see picture )

francesco
Newbie
Posts: 18
Joined: Mon Mar 03, 2008 1:07 pm

Re:Flex+Scicos+Erika !!!

Post by francesco » Mon May 19, 2008 12:25 pm

Sorry, this is the image...

francesco
Newbie
Posts: 18
Joined: Mon Mar 03, 2008 1:07 pm

Re:Flex+Scicos+Erika !!!

Post by francesco » Mon May 19, 2008 12:28 pm

Attachments
schematic.png
schematic.png (20 KiB) Viewed 8057 times

desmomito
Newbie
Posts: 27
Joined: Wed Mar 05, 2008 4:03 pm

Re:Flex+Scicos+Erika !!!

Post by desmomito » Mon May 19, 2008 4:13 pm

Ok,
I understood what you mean. I\'ll just pilot the other optocoupler\'s pin otherwise I\'ll have a \"NOT\" PWM. I\'ll connect the diode LED\'s anode to the FLEX 3.3V and I\'ll pilot the cathode, of course I\'ll not have more the 16mA as current using the right resistor. Could be ok ?
Another question : I have also a current transducer. This one needs 5V and of course the 0V (ground). The maximum current that it absorbs is around 30mA. Where do you suggest me to connect it in order to have the right references and the right measures ?

Thank you,
Pasquale.

francesco
Newbie
Posts: 18
Joined: Mon Mar 03, 2008 1:07 pm

Re:Flex+Scicos+Erika !!!

Post by francesco » Tue May 20, 2008 2:16 pm

I\'ll just pilot the other optocoupler\'s pin otherwise I\'ll have a \"NOT\" PWM

Not properly, I mean that you will not have the right reference voltage. The 3.3V are 3.3V for the Flex board considering GND or GND_OUT. If you take the ground reference of the power supply GND_alim, this will be GND_OUT + or - 1,2V (the voltage across the rectifier diode).

I\'ll connect the diode LED\'s anode to the FLEX 3.3V and I\'ll pilot the cathode, of course I\'ll not have more the 16mA as current using the right resistor. Could be ok ?

You can drive the optocoupler with a buffer that will amplify a little bit the current from the dsPIC (es 74HCT244 search on RS) or you can simply drive the LED of the optocoupler with a BJT transistor (BC547) using the +5V output of Flex and a 1KOhm resistor for the base and try with a 100Ohm on collector. You can connect the diode directly between +5V (anode) and the collector resistence.

The maximum current that it absorbs is around 30mA. Where do you suggest me to connect it in order to have the right references and the right measures ?

I think that the current transducer that you are going to use has a small resistance in order to measure current, I am thinking to the MAX471. This could be placed in series with your load while the logic part that is isolated from the measurement resistence can be directly connected to GND (Flex) and +3V (Flex) and the voltage output can be sampled with dsPIC.

Ciao,
Francesco.

desmomito
Newbie
Posts: 27
Joined: Wed Mar 05, 2008 4:03 pm

Re:Flex+Scicos+Erika !!!

Post by desmomito » Tue May 20, 2008 11:08 pm

What about this scheme to connect the LED of the optocoupler ?
[img width=400]http://www.erika.tuxfamily.org/images/f ... s/opto.png[/img]
Attachments
opto.png
opto.png (20 KiB) Viewed 8057 times

francesco
Newbie
Posts: 18
Joined: Mon Mar 03, 2008 1:07 pm

Re:Flex+Scicos+Erika !!!

Post by francesco » Wed May 21, 2008 8:37 am

You can not drive directly the diode of the optocoupler. You will need to add a transistor, BJT or MOS. The current on the led has to be 10mA but with the dsPIC you can drain maximum 4mA.

Try to match the resistance values on the base and the collector (maybe on a bread board). On the BJT transistor do not use less than 1KOhm.

Another important point is the PWM frequency. Depending on the frequency, you have to use fast optocouplers and fast transistors.

Ciao,

Francesco. [img width=416]http://www.erika.tuxfamily.org/images/f ... fc6dfd.png[/img]
Attachments
opto-ecdd7d3c4a831afb38c6ee1332fc6dfd.png
opto-ecdd7d3c4a831afb38c6ee1332fc6dfd.png (20 KiB) Viewed 8057 times

desmomito
Newbie
Posts: 27
Joined: Wed Mar 05, 2008 4:03 pm

Re:Flex+Scicos+Erika !!!

Post by desmomito » Wed May 21, 2008 10:43 am

OK,
thank you very much but if you see the figure I\'ve posted the current drains from the 3.3V. If the PWM is High = 3.3V the diode if OFF instead if the PWM is Low = 0V the diode is ON and the current drains from the 3.3V power supply into the dsPIC. The current is maximum 16mA in order to not destroy the dsPIC port. Is it wrong what I\'m trying to explain ? Do you thinj is dangerous ?
It\'s just a solution to avoid devices from the dsPIC to the optocoupler because I\'ll have a fast PWM (I\'ve choosen a fast optocoupler).

Thank you,
Pasquale.

Locked