The Smell of Molten Projects in the Morning

Ed Nisley's Blog: Shop notes, electronics, firmware, machinery, 3D printing, laser cuttery, and curiosities. Contents: 100% human thinking, 0% AI slop.

Author: Ed

  • FM DDS: SPI Mock 3

    Running some serial I/O in the background adds jitter to the timer interrupt pacing the ADC samples and as-yet-unwired DDS updates. For reference, an overview of the process showing the procession from the IRQ on the left to the SPI outputs near the middle and another IRQ on the far right:

    DDS Mock - 0 VAC - SPI
    DDS Mock – 0 VAC – SPI

    Now, speed up the sweep and delay the trace by 25 μs to put the triggering pulse off-screen to the left and the second pulse at the center division:

    ADC Sample IRQ jitter
    ADC Sample IRQ jitter

    The orange smear in the middle should be a tidy pulse, but it isn’t.

    The  25 μs timer interrupt now has the highest priority on the front burner:

    IntervalTimer AudioSampler;
    
    ... snippage ...
    
      AudioSampler.priority(0);
      if (!AudioSampler.begin(AudioSamplerIRQ, SamplePeriod)) {
        Serial.printf("Timer start failed\n");
        while (true) {
          FlipPin(BUILTIN_LED);
          delay(75);
        }
      }
    

    Although nothing can interrupt it, other code / handlers may disable interrupts around their own critical sections and delay the tick. If the triggering tick (the off-screen one starting the trace) is delayed, then the on-screen pulse will appear “too soon”, to the left of center. If the triggering tick is on time, but the on-screen pulse is delayed, it’ll appear “too late” on the right.

    The blur is (roughly) symmetric around the center graticule line, so the handwaving seems about right.

    In round numbers, the jitter moves the interrupt ±325 ns on either side of its nominal position, with most of the pulses within ±100 ns. I doubt the jitter distribution is Gaussian, but vigorous handwaving says the RMS jitter might amount to 75 ns.

    At the 4 kHz audio band limit, a 75 ns sampling error a phase error of 0.1°, so the maximum amplitude jitter would be sin(0.1°) = 0.002 = -55 dB, which might suffice for amateur-radio audio.

    I think, anyhow.

  • Monthly Science: As Seen On Radio

    This showed up when I looked at our APRS tracks after a recent ride:

    Balloon chase - KJ5HY-9
    Balloon chase – KJ5HY-9

    Poking around a bit showed the target:

    Balloon chase - W2KGY-12
    Balloon chase – W2KGY-12

    Contrary to what I thought, it didn’t come up the Hudson River from West Point:

    Balloon chase - W2KGY-12 track - 2018-04-21 to 2018-04-24
    Balloon chase – W2KGY-12 track – 2018-04-21 to 2018-04-24

    Knowledge of the Universal Law of the Conservation of Perversity informs you a balloon will never land in the middle of a putting green:

    Balloon chase - W2KGY-12 landing site
    Balloon chase – W2KGY-12 landing site

    Apparently the launch is part of a regular class project at West Point. Good clean fun!

  • Roadside Debris: Cannabis Energy Drink

    Spotted this on Rt 376 during a ride around the block:

    Cannabis Energy Drink - roadside debris
    Cannabis Energy Drink – roadside debris

    A “Cannabis Energy Drink” without the obvious active ingredient seems like deceptive marketing to me, but, apparently, there was no law against that, even here in New York State.

    It’s becoming obvious I don’t get out nearly enough.

  • Pixel XL Camera vs. Barred Owl

    A pair of barred owls have been doing call-response “Who cooks for you” chants during the late afternoon, we finally spotted one, and I have a Pixel XL in my pocket:

    Barred owl - overview
    Barred owl – overview

    That’s with the camera zoomed all the way, so it’s blowing up the raw pixels by a factor of four. Cropping out the middle and resizing by 300% shows the result doesn’t have much detail:

    Barred owl - zoomed 3x cropped
    Barred owl – zoomed 3x cropped

    We snagged the binoculars on the way out the door, so we got a better look than you do. The camera you have is much better than the camera you don’t, but big glass always wins over tiny optics!

  • Mouse Fatality

    It seems the rodents around here have lost their fear of enclosed spaces:

    Drowned mouse
    Drowned mouse

    I cannot be bothered to conjure a mesh lid for the bowl, though.

  • Streaming Radio Player: Continued Glitchiness

    The SPI OLEDs continue to misbehave, with this early morning glitch jamming the display into a complete lockup:

    RPi OLED display - left-edge garble
    RPi OLED display – left-edge garble

    A normal, albeit blind, shutdown-and-reset brought it back to life.

    Other OLEDs on other RPis have occasionally misbehaved since the most recent (attempted) tweak, so it hasn’t made any difference.

    One obvious lesson: prefer OLEDs with I2C interfaces.

  • Teensy 3.6 USB Serial Startup

    The Arduino Serial doc says the USB hardware on the (now obsolescent) Leonardo requires a test-for-open before using the serial port:

      Serial.begin(9600);
      while (!Serial) {
        ; // wait for serial port to connect. Needed for native USB
      }
    }
    

    As it happens, you must also use that test on the ARM-based Teensy 3.6.

    The gotcha happens when the USB port doesn’t become available, in which case the conditional remains true and the loop continues forever, which is precisely what happened when I powered the Teensy from a USB battery pack on the Squidwrench Operating Table.

    After some flailing around, this startup snippet falls through after ahem awhile:

    #define BUILTIN_LED 13
    
    ... snippage ...
    
    Serial.begin(115200);
    
    int waited = 0;
    while (!Serial && waited < 3000) {
      delay(1);
      waited++;
      if (! (waited % 50))
        FlipPin(BUILTIN_LED);
    }
    
    ... snippage ...
    
    Serial.printf(" serial wait: %d ms\n\n",waited);
    

    The serial startup delay seems to vary unpredictably between 800 and 1800 ms, so 3000 ms may be too short:

    serial wait: 1033 ms
    serial wait: 899 ms
    serial wait: 907 ms

    The ARM Teensy connects the board's built-in LED to the same SPI clock as on the AVR Arduinos, so it's only useful during startup, but having some hint will come in handy the next time it jams for another reason.