Arduino encoder

Hola, ¿que tal?
Estoy intentado medir las rpm's con arduino,para esto utilizo un fototransistor y un led infrarojo,ya tengo un contador hecho,al igual que el circuito funcionan muy bien.El incoveniente que tengo, es que no puedo observar el valor de las rpm's ya que el programa los muestra muy rapido.Esto lo hace por que estoy utilizando un elapsed time y el tiempo en el que toma la lectura ( yo asi lo fije) es de 1 seg; por que de lo contrario me mustra el rpm de manera exponencial.Les anexo el programa y muchas gracias por su atencion y tiempo.
Pd:Mi encoder tiene 30 franjas
Adjuntos:
rpm 4.vi ‏36 KB

Hola,
         El problema está en que cuando manejas todo el Arduino desde LabVIEW usando LIFA (LabVIEW Interface for Arduino) todo se hace mas lento ya que cada comando tiene que ser generado en LabVIEW luego transmitido via serial (a 115200bps que se puede decir es lento) y luego se procesa en Arduino y la respuesta se envia de nuevo a LabVIEW por via serial. Entonces esto hace que tu Arduino que podia ejecutar instrucciones a varios Mhz ahora este unas mil veces mas lento. Esto es problema porque las cajas de LIFA solo hacen cosas básicas, pero si les agregas funciones que hagan de una vez todo lo que deseas puede servir.
          Si te gusta mucho LIFA, una opción es que hagas las modificaciones de manera que medir RPM sea como una instrucción y le agregas el código en arduino para que la ejecute y regrese el resultado. Asi mantendrias las mismas cajitas y todo seria funcional y se veria de maravilla, y si lo haces bien me imagino lo pueden integrar a futuras versiones de LIFA.
          Si no te quieres averiguar como funciona LIFA, y solo quieres algo que funcione de cualquier manera, puedes hacer tu propio código de arduino que haga la medición de RPM y lo mande por puerto serial, y en LabVIEW haces un código que reciba datos por puerto serial y lo muestre.
          Tu escoje el camino y cualquier duda que tengas no dudes en preguntar.
Saludos,
Luis A. Mata C.
Ing. Electrónico
Anaco - Venezuela

Similar Messages

  • Arduino due and Labview wirelss serial communication using Xbee

    Hello.
    I am controlling a mobile robot using the Arduino due and labview
    PWM value caculated on the labview is sent to Arduino due and then Due controls the robot.
    These communicate wirelessly by xbee.
    Now, I'd like to increase the communication speed between Arduino due and Labview.
    but, when i set the value of the "Wait(ms)" function to below 10ms  in Labview, communication has unstability.
    so please let me know how increase the communication speed.
    thank you.
    -experiment image-
    https://www.youtube.com/watch?v=oZdMCdHlDhM
    - Arduino source-
    #include <string.h>
    int PWM1 = 5;
    int DIR1 = 4; //direc
    int PWM2 = 6;
    int DIR2 = 7; //dir
    float readNumber = 0;
    float In1, In2, pwm, newtime, A;
    float newposition1 = 0;
    float newposition2 = 0;
    unsigned int Aold1 = 0;
    unsigned int Bnew1 = 0;
    unsigned int Aold2 = 0;
    unsigned int Bnew2 = 0;
    volatile long encoder1Pos = 0;
    volatile long encoder2Pos = 0;
    int encoder1PinA = 8;//Encoder A pin
    int encoder1PinB = 9;//Encoder B pin
    int encoder2PinA = 11;//Encoder A pin
    int encoder2PinB = 12;//Encoder B pin
    int Direction1, Direction2;
    float pwm1_limit=255;
    float pwm2_limit=255;
    float count_old = 0;
    float power1_old, power1_old2, power1_old3, power1_old4, power1_old5;
    void setup() {
    // put your setup code here, to run once:
    pinMode(DIR1, OUTPUT);
    pinMode(DIR2, OUTPUT);
    Serial.begin(115200);
    Serial.flush();
    Serial2.begin(115200);
    Serial2.flush();
    pinMode(encoder1PinA, INPUT);
    digitalWrite(encoder1PinA, HIGH); // turn on pullup resistor
    pinMode(encoder1PinB, INPUT);
    digitalWrite(encoder1PinB, HIGH); // turn on pullup resistor
    pinMode(encoder2PinA, INPUT);
    digitalWrite(encoder2PinA, HIGH); // turn on pullup resistor
    pinMode(encoder2PinB, INPUT);
    digitalWrite(encoder2PinB, HIGH); // turn on pullup resistor
    attachInterrupt(encoder1PinA, d1EncoderA, CHANGE);
    attachInterrupt(encoder1PinB, d1EncoderB, CHANGE);
    attachInterrupt(encoder2PinA, d2EncoderA, CHANGE);
    attachInterrupt(encoder2PinB, d2EncoderB, CHANGE);
    void loop() {
    if(Serial2.available()>0){
    String first = Serial2.readStringUntil('!');//랩뷰에서 받는 2개의 값을 분리하기 위한 소스("!"앞까지 끊고, "@"앞까지 끊음 ex)123!456@을 받으면 123과 456으로 나눔)
    String second = Serial2.readStringUntil('@');//http://stackoverflow.com/questions/29504679/splitting-a-comma-separated-string-through-serial-arduino
    float x = first.toFloat();//위에서 분리된 문자를 float형으로 바꿔줌
    float y = second.toFloat();
    newposition1 = -encoder1Pos; //Encoder signal
    newposition2 = encoder2Pos; //Encoder signal
    count_old = 0;
    float power1 = x;
    float power2 = y;
    if(power1 >= 0){
    Direction1 = LOW;
    else{
    Direction1 = HIGH;
    if(power2 >= 0){
    Direction2 = HIGH;
    else {
    Direction2 = LOW;
    power1 = abs(power1);
    power2 = abs(power2);
    if(power1 > pwm1_limit){
    power1 = pwm1_limit;
    if(power2 > pwm2_limit){
    power2 = pwm2_limit;
    digitalWrite(DIR1, Direction1); //HIGH = back, LOW = forward
    digitalWrite(DIR2, Direction2); //HIGH = back, LOW = forward
    analogWrite(PWM1, power1);//PWM Speed Control
    analogWrite(PWM2, power2);//PWM Speed Control
    String strValue = String(newposition1);//숫자를 문자형으로 변환
    String Q = "!";
    String strValue2 = String(newposition2);
    String stringThree = strValue + Q + strValue2;//문자 합치기
    Serial2.println(stringThree);//Send encoder pulse to Labview
    else {//when Serial communication stop
    float count = count_old+1;
    if(count > 10000){
    newposition1 = 0; //Encoder initialization
    newposition2 = 0; //Encoder initialization
    encoder1Pos = 0;
    encoder2Pos = 0;
    else{
    newposition1 = newposition1; //Encoder signal
    newposition2 = newposition2; //Encoder signal
    count_old = count;
    Serial.println(count);
    //Encoder Read//////////////////////////////////////////////////////////
    void d1EncoderA()
    Bnew1^Aold1 ? encoder1Pos++ : encoder1Pos--;
    Aold1 = digitalRead(encoder1PinA);
    void d1EncoderB()
    Bnew1 = digitalRead(encoder1PinB);
    Bnew1^Aold1 ? encoder1Pos++ : encoder1Pos--;
    void d2EncoderA()
    Bnew2^Aold2 ? encoder2Pos++:encoder2Pos--;
    Aold2=digitalRead(encoder2PinA);
    void d2EncoderB()
    Bnew2=digitalRead(encoder2PinB);
    Bnew2^Aold2 ? encoder2Pos++:encoder2Pos--;
    }

    piZviZ wrote:
    Only data rate working is 9600  between labview and launchpad(arm cortex m4).Where all data rates work between Arduino serial port monitor and launchpad(arm cortex m4).
    Since the only thing that changed is the Launchpad, then that must be the issue.  Are you sure this device can handle more than just the 9600 baud rate?  Are you sure you are even setting the baud rate on this device?

  • Adobe media encoder error in photoshop

    Hi everyone!This morning i have tried to render a video timelapse in photoshop but it showed to me an error which says:''Could not complete the render video command because of a problem with Adobe Media Encoder''.Could anyone tell me how can i fix this error?

    Nobody can tell you anything without proper system info or other technical details like exact versions, render settings, details about the source files and so on.
    Mylenium

  • Filename in Media Encoder CC

    Hello there ;-)
    In After Effect CC u can render picture sequences using a filname like: "Project_[#####].jpg". The [#####] is replaced by the framenumber when rendering. When i render a picture sequenc in Media Encoder CC i Don´t have that oportunity. It allways starts with a Number like 000001. My Question - is it possible to change that in the encoder? So that i have the Frame number in the filename like in After Effect CC? If yes - how? I haven´t find anything!
    THANX for your help!

    I have this issue too. It makes After effects impossible to use with media encoder.  What we want is the actual frame number from After effects
    Example
    I have a 5000 frame AE export.
    I can export the lot from AME
    Render0000.png - Render5000.png
    Client makes a change to Frames 4500-5000
    Try and render Work area to AME
    Result = Render0001.png -  Render0499.png
    The only way to keep file numbers is to use AE's render Queue which seem to be way slower than AME?

  • Análise de vibração de um motor a partir de Arduino e identificação de falhas

    Olá a todos. Sou novato no mundo do LabVIEW, por isso gostaria de uma ajuda de vocês. Tenho em minha faculdade o LabVIEW 2010.
    Estou realizando meu projeto de final de curso e tenho como objetivo identificar falhas em um motor a partir da vibração medida com um acelerômetro. Para explicar melhor meu objetivo, separei ele em três problemáticas:
    - Aquisição de dados:
    O primeiro passo é realizar a aquisição dos dados provindos do sensor. Visando baixos custos, opitei por usar o conjunto Arduino + Sensor ADXL345. Porém tive dificuldades em utilizar o protocolo I2C com o LabVIEW usando o LIFA (LabVIEW Interface for Arduino). Acabei optando por utilizar o próprio Arduino para medir a vibração e usar o VISA do LabVIEW para realizar a aquisição de dados. Para isso utilizei o VI em anexo que encontrei na internet. ele funciona muito bem, mas gostaria de utilizá-lo como Sub-VI em outro VI, já que o acelerômetro tem três medidas (X, Y e Z) e estou tendo dificuldades para isso, graças ao White Loop. Tirando o White Loop e os Switches, não consegui fazer dados saírem para outro VI, alguém pode me dar uma luz?
    - Tratamento dos dados:
    Antes de identificar o erro, gostaria de aplicar uma transformada de fourier nos dados que estão entrando (x, y e z) a fim de gerar um gráfico no fomínio da frequência. Alguém tem um exemplo de uso do bloco de transformada de Fourier no LabVIEW para eu estudar? Outras dicas são muito bem vindas.
    - Comparação dos dados:
    O último passo é usar alguma técnica de comparação de dados (como o Comparison Express) para comparar a vibração do motor com dados previamente armazenados em um arquivo de texto ou planilha, com a finalidade do LabVIEW identificar por conta própria qual é a falha presente no motor. Porém tive dificuldades em usar um arquivo como Input no Comparison Express, alguém já fez isso antes?
    Enfim, agradeço antecipadamente qualquer ajuda que receber. Como sou novo no LabVIEW, estou tendo várias dificuldades, mas espero conseguir atingir meus objetivos. Lembrando que estou com o LabVIEW 2010, se vocês puderem compartilhar VIs compatíveis vão me ajudar muito.
    Anexos:
    Data Aquisition.vi ‏37 KB

    Bom dia otaconlink. Tudo bem?
    Aquisição de dados:
    Gostaria de saber o que você gostaria de modificar no programa, são os dados de vibração?
    Tratamentos de dados:
     O seguinte link indica alguns exemplos aplicáveis ao seu programa:
    http://venus.ni.com/nisearch/app/main/p/bot/no/sn/catnav%3Aexample/ses/false/ap/global/q/fourier/lan...
    Comparação de dados:
    Você pode utilizar a estrutura de caso.
    Alguns exemplos de comparação de dados:
    http://zone.ni.com/devzone/cda/epd/p/id/4719
    http://zone.ni.com/devzone/cda/epd/p/id/5219
    https://decibel.ni.com/content/docs/DOC-12441
    http://zone.ni.com/devzone/cda/epd/p/id/5785
    Atenciosamente.
    Erick Yamamoto
    Application Engineer
    National Instruments Brazil
    Visite a nossa comunidade em PORTUGUÊS!!!

  • Conversion of XML file from ANSI to UTF-8 encoding in SAP 4.6C

    Hi All,
      Im working on SAP 4.6C version.I have generated a XML file from my custom report.It is downloading in ANSI format.But i need to download this into UTF-8 format.So can anyone please let me know how to do this?
    Is this possible in 4.6C version?
    Thanks in Advance,
    Aruna A N

    Hello
    It is possible in 4.6.
    Try this code:
    REPORT Z_TEST_XML_DOWN .
    data:
      lp_ixml type ref to if_ixml,
      lp_xdoc type ref to if_ixml_document,
      lp_sfac type ref to if_ixml_stream_factory,
      lp_ostr type ref to if_ixml_ostream,
      lp_rend type ref to if_ixml_renderer,
      lp_enco type ref to if_ixml_encoding.
    data:
      lp_root type ref to if_ixml_element,
      lp_coll type ref to if_ixml_element,
      lp_elem type ref to if_ixml_element.
    class cl_ixml definition load.
    data:
    udat like lfa1,
    s type string.
    select single * from lfa1 into udat where lifnr = '0000000001'. " <- set here real number
    *** create xml
    lp_ixml = cl_ixml=>create( ).
    lp_xdoc = lp_ixml->create_document( ).
    lp_root = lp_xdoc->create_simple_element( name = 'Node'
                                              parent = lp_xdoc ).
    s = udat-land1.
    call method lp_root->set_attribute( name = 'country_name'
                                        value = s ).
    s = udat-name1.
    call method lp_root->set_attribute( name = 'vendor_name'
                                        value = s ).
    s = udat-ort01.
    call method lp_root->set_attribute( name = 'city_name'
                                        value = s ).
    *** render xml
    types: begin of xml_tab_line,
             line(256) type x,
           end of xml_tab_line.
    types: xtab type table of xml_tab_line.
    data: t_xml type xtab,
          size type i,
          rc type i.
    lp_sfac = lp_ixml->create_stream_factory( ).
    lp_ostr = lp_sfac->create_ostream_itable( table = t_xml ).
    lp_enco = lp_ixml->create_encoding( character_set = 'utf-8'
                                   byte_order = if_ixml_encoding=>co_none ).
    call method lp_ostr->set_encoding( encoding = lp_enco ).
    lp_rend = lp_ixml->create_renderer( ostream = lp_ostr
                                        document = lp_xdoc ).
    rc = lp_rend->render( ).
    *** export to file
    size = lp_ostr->get_num_written_raw( ).
    call function 'WS_DOWNLOAD'
      exporting
        bin_filesize = size
        filename = 'c:\sapxml_test.xml'
        filetype = 'BIN'
      tables
        data_tab = t_xml
      exceptions
        others = 1.
    It is just simple example.

  • Media Encoder CC mpeg2 Question

    Basically what the title says. Where exactly is the option to format a video into an mpeg2 file? I've been Googling this to death. I know I've seen some people say they had it, then it disappeared. But I literally just downloaded Media Encoder and its nowhere to be found. Even under the DVD and Blue-ray section, the only options are for Blue-ray. I need to burn a wedding video onto a DVD. Is there something special you have to do to get this done? Are there limits on the free trial version that don't allow mpeg2 downloads? Help!

    Are you using AME CC 2014?  MPEG2 is included in AME under more strict license than other formats and is only activated only if you have Premiere Pro CC 2014, AfterEffects CC 2014 or Prelude CC 2014.  If you are using them under a free trial, MPEG2 becomes unavailable after a trial period expires.  After a trial has been expired, AME CC 2014 can be used extra 30 more days, but without MPEG2. 
    If you already used up a trial period, you can either 1) install one of three apps I mentioned earlier that you haven't installed before and activate it as a trial or 2) purchase a subscription for Creative Cloud.  #1 option allows you to use MPEG2 30 more days.  With #2 option, you can use MPEG2 as long as you keep your subscription active.  I hope this helps.

  • Media Encoder CC

    I have the Adobe Creative Cloud on the new Mac Pro. Now I can no start the Media Encoder. Am I the only one who has the problem?
    Can anyone help me?

    Hi Media Encoder CC,
    Welcome to the Forums.
    Please follow the KB Article provided below and check whether it resolves your issue or not.
    http://helpx.adobe.com/creative-cloud/kb/ame-premiere-crash-launch-export.html
    Regards,
    Vinay

  • Media encoder cc export issue

    i got a user that have issue export with media encoder
    when she encode she get this error
    any idea
    Thanks

    Any one ?

  • Media Encoder CC won't launch

    I've been succesfully working with media encoder for sometime now but it won't start for some reason. Using Mac OS 10.6.8, icore 7 proc, 16gb RAM, Encoder CC 6.0.2 what's causing this?

    Thanks, It started working after I logged into my Adobe account. Curious if that had anything to do with it. I also tried a few options (similar to this) I found in the forum which didn't help until I restarted. Not sure which one did it but it's all good now. Thanks!
    cid:E05335EC-C91D-4503-A609-511A1CD6F2EE
    Randy Cates | Video/Motion Graphics
    800.440.1088
    14287 N. 87th St. Suite 220
    Scottsdale, AZ 85260
    Fax: (480) 949-2427
    cid:81ED8132-3DE8-4E8D-973C-64CDC5BC8985<http://www.facebook.com/shurwest>  cid:A3749390-E4AB-4976-BE58-B02192E9077F <http://www.twitter.com/shurwest>   www.shurwest.com<http://www.shurwest.com/

  • Media Encoder CC 14 renders with black frame at the end

    Hello,
    my Media Encoder running on Mac Yosemite makes a black frame at the end of h264 clips...
    How can i fix this?
    Thanks

    I just figured out - it might be a quicktime viewer problem...

  • Media Encoder CC  won't render Magic Bullet Denoiser II

    Hello there,
    i've got the following Problem: I am having Premiere CC and used the Red Giant Plug-In Denoiser II on my last project, when i import this project to the Media Encoder and select Quicktime for output, the Media Encoder won't render the clip with this Plug-In. i always get the original files out, without the denoiser. Original footage from in premiere is 2,5k CinemaDNG RAW from the Black Magic Cinema Camera.
    thx

    I feel like there was a recent update to the RG plugins (inside of the last 30 or so days.) Are they up to date?

  • Media Encoder CC // Red Giant Denoiser II

    Hello there,
    i've got the following Problem: I am having Premiere CC and used the Red Giant Plug-In Denoiser II on my last project, when i import this project to the Media Encoder and select Quicktime for output, the Media Encoder won't render the clip with this Plug-In. i always get the original files out, without the denoiser.
    thx

    no windows, footage is cinemaDNG 2,5k RAW from Blackmagic Cinema Camera.

  • Media Encoder CC - Bug or just finicky?

    I'm confused about Media Encoder, and hoping someone can help.
    I have a short film that's primarily 4K ProRes augmented with some "flashbacks" that are 1920 by 1080 h264 files.  All edits beautifully in my 4K ProRes timeline.
    I have some Magic Bullet B&W corrections on the 1080 footage.  On the 4K footage, I just have an overall grade in an Adjustment Layer (for now).  I can play in Software Mode (CUDA won't work on my Retina Mac - separate thread!) at 1/4 resolution.  The 4K stuff looks great, the 1080 pretty bad.
    I've been outputting by matching sequence settings.  The file is TITANIC, but looks great.  I use that file to make various smaller files in APPLE COMPRESSOR.  I find it better and more flexible (especially with cropping for 2.35, etc.)  What can I say.  All in all, the workflow works for me.
    So here's the problem.  Today I wanted to use In and Out to export a small section for music review with a colleague.  No need to have a huge file, I just used Media Encoder in a Vimeo SD mode. 
    In the first attempt, the 1080 stuff oddly looked terrible.  Just as it does when viewed at 1/4 resolution.  To make sure everything was okay, I outputted that section at Matched Sequence settings.  All good - the 1080 stuff had the Magic Bullet B&W look working great.
    Then I tried again with the Vimeo SD setting.  Only this time I checked Render at Maximum Resolution.  Took FOREVER, but all good again.  The 1080 stuff was fine.
    Next I renendered "in to out" in my sequence (I hadn't done so previously - I was working "red line").  Output without checking Max Render Quality.  Back to the horrible 1080 stuff.
    Finally, I chose "use previews", but not max render.  All good again.
    So, at last a question.  Does this make sense?  I never before had to use either Maximum Render OR Use Previews to get acceptable quality with "device" settings.  Is this a bug?  Or related to my disparate picture sizes?  Or something else?  Thank you all!

    [Moved to AME forum.]
    I can see where this would be expected behavior.

  • Media Encoder CC Encoding Failure

    I have never had any problems with Media Encoder on my system, but since ugrading from CS6 to CC suddenly the Media Encoder fails whenever I use the QUEUE rather than EXPORT on the Export Settings screen in Adobe Premiere Pro CC. 
    When I click the Failure link for more information, it just pulls up the log which tells me that Encoding Failed.  Has anyone else experienced this?  Any ideas for how to resolve it?
    It's not a huge problem because I can always encode each video one at a time by clicking export, but being able to batch process a bunch of videos at a time helps the workflow.  THANKS!

    Yes, AME queue is a problem.  I have a 28 minute weekly broadcast for a client that must be encoded in 6 different formats for TV Broadcast, mpeg2 DVD, vimeo, mp3, h.264 for vimeo, etc.  If I attempt to encode all 6 in the queue I will have some success and also failure.   If I queue several videos that all require mpeg2 (though with each requiring several different specs, i.e., upper field vs. lower field, mpeg2 dvd, mpeg2 HD, etc.) it will complete the task.  Yet if I add h.264 to the mix all encodes will fail.  I can encode h.264 by itself with no problems.  So yes, you are not alone.  Not sure what the solution is.  In CS6 one could queue all of these formats and walk away.  Can Adobe acknowledge these issues and then propose a solution?

Maybe you are looking for

  • How to change the box width of a template

    Hi, I want to set a Lower margin for the last row in the template of a described width. I am trying to change the widh of box in the template. but even after saving and activating the form the chages are lost the next time i logged in to the ECC. its

  • Spry menubar not working correctly in IE9 - fixed width or padding or...?

    Need help.  My spry menu bar isn't all the way to the right when in compatibility mode in IE9.  When not in compatibility mode it is even further from the right.  Is there a way to make it so that it is all the way to the right on both compatibility

  • Handling Soap Faults in orchestration

    I have BizTalk exposing a WCF-BasicHttp endpoint, and an orchestration that picks it up, calls another WCF service and send the result back to the client. Any exceptions from the back-end service is handled using "Propagate Fault Message" setting on 

  • Performance while editing

    I haven't had any performance problems with FCP X up until today.  All of a sudden the cursor started moving jerkily nad I get a messge that my hard drive may not be fast enough.  I have two external hard drives, both Firewire, and one of them was ge

  • Ignore 2nd row and 4th row in Excel Sheet in SSIS Package

    Hi All, I have an SSIS package that imports an Excel sheet in which i have to ignore 2nd row and 4th row. Please help me on this issue.