Scanning Electron Microscope Images And Animations Pulled By Impressive Teensy LC Setup

When you’ve got a scanning electron microscope sitting around, you’re going to find ways to push the awesome envelope. [Ben Krasnow] is upping his SEM game with a new rig to improve image capture (video link) and more easily create animated GIFs and videos.

The color scheme of the SEM housing gives away its 80s vintage, and the height of image capture technology back then was a Polaroid camera mounted over the instrument’s CRT. No other video output was provided, so [Ben] dug into the blueprints and probed around till he found the high-resolution slow scan signal.

To make his Teensy-LC happy, he used a few op-amps to condition the analog signal for the greatest resolution and split out the digital sync signals, which he fed into the analog and digital ports respectively. [Ben] then goes into a great deal of useful detail on how he got the video data encoded and sent over USB for frame capture and GIF generation. Reading the ADC quickly without jitter and balancing data collection with transmission were tricky, but he has established a rock-solid system for it.

It’s clearly a work in progress by [Ben]’s own admission, but it’s still really exciting. His previous animations of a stylus in a vinyl record groove were great to watch but laborious for him to produce. Here’s hoping that lowering the effort needed to make these animations will result in more of them. We hope so too!

29 thoughts on “Scanning Electron Microscope Images And Animations Pulled By Impressive Teensy LC Setup

        1. Do you even realize how much marketing costs? $15K for persistent exposure on very popular YT channel is NOTHING.
          For example M$ was paying $ 15K-30K PER SINGLE fake video praising shitty RYSE game and Xbone.

          >”The FTC said that two of the YouTube video creators were paid $15,000 and $30,000 each for their videos”

          Welcome to reality my friend.

        2. A lot of the $15k price is probably to cover for development of the scope. If the manufacturer gives one to someone that wouldn’t have bought one otherwise your cost is only the manufacture cost.

          There are an earlier video where he uses the oscilloscope itself to gather the data for the frames, seems like a nice piece of kit. I guess I have to be content with my cheapo rigol :(.

          1. As long as they can keep up with both demand and a few extra to give away they wouldn’t sell any less. And I guess they wouldn’t give them away as marketing if they couldn’t produce them fast enough.

    1. He says he’s averaging 4 samples so the real sample rate is close to 800 kHz.
      He’s using the ADC in 8 bit mode, so there is some room for improvement there, It’s likely because he’s limited to the transfer speed of USB HID.
      Also he’s sampling synchronized with the h and v sync, it would not be possible to do this on a pc soundcard, eg. like in the ADC free running mode. he needs to start & stop acquisition during the sync.

  1. Not too surprised. I know folks who were doing this with 1 MHz Apple IIe and displaying on Redshift ImageWorks II grey scale card for ][e //gs in the 1980’s. Dapple Systems sold them. A Teensie must benchmark at 10 or 20 Apple II. (we should have an Apple II based BM for these 8 bit systems).

  2. I programmed Apple ][ assembly back in the day, and I know a thing or two about Teensy & modern ARM microcontrollers…..

    The raw performance difference is *much* more than 20X. That old 6502 chip ran at 1 MHz. Its instructions took 2 to 6 of those lengthy cycles to execute. Accessing memory beyond the first 256 bytes (the precious “zero page”) took 4+ cycles. The processor had only 3 registers for data. Multiplication required a lengthy subroutine! Multi-bit shifting required loops.

    ARM Cortex-M0+ runs at 48 MHz on Teensy-LC. Most instructions execute in 1 cycle. It has 8 general purpose 32 bit registers for data, plus several more for special uses. The entire 4 GB address space can be reached with load & store instructions that execute in 2 or 3 cycles. Memory access is 8, 16 or 32 bits, so a single instruction can load or store 4 bytes at the same time. 32×32 multiply is implemented in hardware as a single-cycle instruction. 1 to 32 bit shifts are single cycle.

    While the old Apple ][ technically had interrupts, they were virtually unusable. A funny chaining scheme between the slots meant cards in the upper slots depended on hardware support in the lower slots. By the time the Apple ][e with 80 column card was in mass production, no portion of the 64K address space was free from bank swapping. Use of interrupts required placing code in multiple memory banks, and a tremendous amount of fancy interrupt epilogue and prologue code to simultaneously deal with bank swapped memory while saving and restoring processor context. Practical interrupt entry and exit was so slow that almost no products used interrupts.

    Modern Cortex-M handles interrupts very efficiently. The hardware automatically saves about half of the execution context (the half which C functions are allowed to clobber) onto the stack, all implemented in hardware. Of course, the entire memory space is a flat 4GB address range (unlike 8 bit AVR & PIC). Interrupt entry and exit takes approx 16 cycles on Cortex-M0+, with the code ready to actually run with access to R0-R3, LR and other necessary registers (already pushed onto the stack, unlike 8 bit AVR & PIC). The Cortex-M NVIC interrupt controller also automatically nests multiple priority levels, so you can had high priority interrupts which interrupt lower priority ones, all handled automatically with no extra software overhead!

    Cortex-M microcontrollers like Teensy are equipped with very efficient DMA controllers and multiple buses connected by a switched bus matrix. Often DMA can access RAM and peripherals simultaneously with the other buses serving the CPU core’s needs. In the old days of the Apple ][, sometimes the system RAM was shared 50-50 with the video hardware, which was idle during the video blanking interval, but no practical DMA access existed. Moving data anywhere to/from memory required slow loops, using those 4+ cycle instructions. ProTerm, a popular terminal emulator program of the mid-1980, achieved 9600 baud data flow while scrolling the 80 column text using an incredibly complex piece of hand optimized assembly code which repeatedly checked for more incoming serial data as is gradually moved each lines data upwards in the memory read by the Apple ][‘s text frame buffer!

    The Apple ][ was a great machine in its day. Incredibly ingenuity with assembly coding and special hardware allowed it to do amazing feats for its slow speed. I still have a lot of fond nostalgia for that old Apple ][…. but not enough to believe it was anywhere close to 1/20th of the performance of even the lowest of the 32 bit ARM Cortex-M microcontroller today.

  3. What is with the dumb symbols, that are after Apple(xx)! 2 or II (Cap Eye x2)for you Romans that still can’t count. When you ain’t got zero, what number do you use?
    I remember seeing Steve and Steve pushing them in “78 and have a IIe in the closet.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.