esp32 - IR intervalometer for Sony a7

Posted on
Page
of 2
Prev
/ 2
  • Yes, only integer. I noticed this. But I hope this is just an example. I will try to find additional information.

  • I bought a logic analyzer yesterday. Thanks for the advice, I did not know that they are so cheap. Now I've seen everything going on, it's super helpful.

    analogWrite is very stable with an ideal 40kHz output. But digitalPulse gives pulses of the wrong duration, and the duration of these pulses changes randomly. I will attach screenshots a little later.
    I also checked the work of the Arduino. This module is extremely stable and predictable. The signal is perfect.

  • This is esp32


    2 Attachments

    • Screenshot at 2021-09-14 23-39-41-01.jpeg
    • Screenshot at 2021-09-15 07-46-39-01.jpeg
  • The duration of the impulses is incorrect. It is about 1.4-1.5 times longer than it should be. For example, instead of 0.6ms, I see 0.96ms.
    Integers gives exactly the same problem. This is (floats) not the problem.

  • This is arduino nano board


    1 Attachment

    • Screenshot at 2021-09-15 07-30-04-01.jpeg
  • I also checked the ratio of 40kHz impulses. It does not in any way affect the result. I changed it from 1: 1 to 1: 4. At any ratio, camera control works.

    I assumed that the problem might be that I have several arrays with timings. And I combined everything into one array. This eliminated multiple digitalPulse calls and loops. But that didn't help either ...

    const IR_ANODE = D17;
    const IR_CATHODE = D16;
    const IR_FREQ = 40000;
    const pulse_ratio = 0.25;
    //....
    var run = function () {
    //....
        digitalWrite(IR_CATHODE,0);
    
        let pulses = [2.4, 0.6, 1.2, 0.6, 0.6, 0.6, 1.2, 0.6, 1.2, 0.6, 0.6, 0.6, 1.2, 0.6, 0.6, 0.6, 0.6, 0.6, 1.2, 0.6, 0.6, 0.6, 1.2, 0.6, 1.2, 0.6, 1.2, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 1.2, 0.6, 1.2, 0.6, 1.2, 0.6, 1.2, 11.6, 2.4, 0.6, 1.2, 0.6, 0.6, 0.6, 1.2, 0.6, 1.2, 0.6, 0.6, 0.6, 1.2, 0.6, 0.6, 0.6, 0.6, 0.6, 1.2, 0.6, 0.6, 0.6, 1.2, 0.6, 1.2, 0.6, 1.2, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 1.2, 0.6, 1.2, 0.6, 1.2, 0.6, 1.2, 11.6, 2.4, 0.6, 1.2, 0.6, 0.6, 0.6, 1.2, 0.6, 1.2, 0.6, 0.6, 0.6, 1.2, 0.6, 0.6, 0.6, 0.6, 0.6, 1.2, 0.6, 0.6, 0.6, 1.2, 0.6, 1.2, 0.6, 1.2, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 1.2, 0.6, 1.2, 0.6, 1.2, 0.6, 1.2, 0.6];
      
        function shot(){
            analogWrite(IR_ANODE, pulse_ratio, {freq:IR_FREQ});
            digitalPulse(IR_CATHODE,1,pulses);
            digitalPulse(IR_CATHODE,1,0);
            digitalWrite(IR_CATHODE,0);
            digitalRead(IR_ANODE);
        }
    //....
        function some_function(){
            //....
            console.log('shot');
            shot();
            //....
        }
    //....
    };
    

    Wifi can be the cause of such problems (the module cannot cope with such a load)? The module is connected to a router and is controlled by wifi

    Is it possible to somehow disable all other processes during the transmission of the IR signal, or change their priority?

    Maybe the problem is low JS speed and I need to use C?

    I have no more ideas yet. Can you suggest anything?

  • Disabled everything except IR signal generation, now the minimal code. It didn't help either. The first code sequence consists of the required number of pulses (21). But they are all with the wrong duration and pauses. The second and third sequences are slightly better, but there are also offsets. And the duration of the impulses is longer than the specified one.

    Now I definitely can't change anything. There is a minimal code left.

    I don't understand how a module that is much more powerful than arduino nano is not able to solve this simple task ...
    What is it for then? Blinking chaotically with LEDs?

    [add]
    I flashed the code from arduino nano to esp32. It works just as perfectly as it does on the arduino board. It turns out this javascript is so slow...


    1 Attachment

    • esp32_2.jpg
  • Wed 2021.09.15

    Work has me bogged down @lshk. Composing at least three comprehesive replies I will respond with, just not today.

  • Sat 2021.09.18

    I went back to start my response to post #24 and post #25 but the content is removed.
    In the mean time . . .

    reply to post #27

    I bought a logic analyzer yesterday. Thanks for the advice, I did not know that they are so cheap.
    Now I've seen everything going on, it's super helpful.



    The Bitterness of Poor Quality, Remains Long After the Sweetness of Low Price is Forgotten!

    circa 1975 from a Flanner and Hafsoos premium audio equipment store sign.



    Choice of words in the English language at times can be a bit of a challenge.

       Cheap refers to low quality.    Inexpensive refers to low cost.

    With the images that were posted in #28 shows your inexpensive purchase provides a good quality value being able to provide the snapshot of pulse timing that was desperately needed. More on that follows. . . .

  • Sat 2021.09.18

    reply to post #26

    Yes, only integer. I noticed this.
    post #29 For example, instead of 0.6ms, I see 0.96ms.

    I'm not sure if you were aware of this linking reference @lshk

    Adjacent to the heading: function digitalPulse

    http://www.espruino.com/Reference#l__glo­bal_digitalPulse

    is a right facing arrow that when clicked on takes one to the source code for that function.

    https://github.com/espruino/Espruino/blo­b/master/src/jswrap_io.c#L224
    jsExceptionHere(JSET_ERROR, "Pulse Time given for digitalPulse is less than 0, or not a number");



    I'm surprised the exception wasn't observed within the WebIDE. Maybe it bubbles up and requires a try/catch block wrapper around the digitalPulse() call.

  • Sun 2021.09.19

    A brief history summary to respond to several questions in subsequent posts that follow.

    ref post #14 Arduino Nano and 'What is it for'



    Microcontrollers started to hit the consumer market during the mid 1990's. I was busy programming 8051 and 8255 using assembler. Norton and PKWare zip were popular then. The switch from bulletin board modems to ISP and the introduction of smart cells phones was underway.

    The PIC microcontroller was developed in the year 1993 by Microchip Technology. The term PIC stands for Peripheral Interface Controller.

    https://www.watelectronics.com/pic-micro­controller-architecture-and-applications­/



    A decade later, while in my favorite Radio Shack scrounging parts, I spotted the introduction of a tool for hardware geeks. The year was 2005 with the introduction of the first Arduino board. I added this to my X-Mas list as a back burner project.
    (I had books on the PIC but hadn't drawn the relationship with Arduino at that time. With life in the way and running out of remaining years, I picked up on Espruino in 2016 and finally purchased that X-Mas wish in 2017 !)

    https://www.arduino.cc/en/Main/AboutUs



    The popular Arduino Nano was first released in 2008 consisting of an ATmega328 8-bit microcontroller by Atmel Microchip Technology.

    https://www.makerguides.com/arduino-nano­/#:~:text=The%20Arduino%20Nano%20was%20f­irst,by%20Atmel%20(Microchip%20Technolog­y).



    Gordon would have his inspiration start to evolve using the STM32 microcontroller integrated circuits by STMicroelectronics with the 2013 successful Kickstarter campaign.

    https://en.wikipedia.org/wiki/Espruino
    https://en.wikipedia.org/wiki/STM32



    Espressif Systems developed their Tensilica Xtensa LX6 microprocessor and released the ESP32 in 2016

    https://www.wia.io/things/espressif-esp3­2



    Current day 2021, we have a myriad of microcontrollers developed by many manufacturers.

    http://www.espruino.com/Other+Boards

  • Sun 2021.09.19

    reply to post #14

    'simply by connecting the Arduino Nano to the ESP32. I did it and it works.'

    'But I want to implement everything on esp32'


    Reviewing the images from post #30, #32 and #32 it is difficult to observe the initial state of the pulse train. It also isn't possbile to determine the squareness of the leading pulse edges.

    For what it's worth, after hours of struggle with SPI, I2C and UARTS, I discovered a floating CS Chip Select pin that rounded out the leading edge, so the receiving device never started the data receive.

    http://forum.espruino.com/comments/14687­689/

    Adding a scope probe or a logic analyzer probe may result in unwanted expectations.
    (see unrelated use at:)

    https://hackaday.com/2017/01/20/cheating­-at-5v-ws2812-control-to-use-a-3-3v-data­-line/


    From this post some non-original boards have inverted pins and non-assigned pin designations.

    http://forum.espruino.com/conversations/­338814/#comment14912700



    From the microcontroller summary above in post #36 we have a move from the Microchip ATmega328 to the Espressif ESP32 running source streamlined originally for the STMicroelectronics STM32. The internal die would be different for each chip manufacturer and therefore the electrical characteristics will be different.



    As a logic analyzer tends to square up the pulse, is it possible that there is a rounding of the leading pulse edge or even an inversion of the pulse train along with a chip select that isn't behaving as it should?

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

esp32 - IR intervalometer for Sony a7

Posted by Avatar for lshk @lshk

Actions