The Need For Speed?

We wrote up a video about speeding up Arduino code, specifically by avoiding DigitalWrite. Now, the fact that DigitalWrite is slow as dirt is long known. Indeed, a quick search pulls up a Hackaday article from 2010 demonstrating that it’s fifty times slower than toggling the pin directly using the native pin registers, but this is still one of those facts that gets periodically rediscovered from generation to generation. How can this be new again?

First off, sometimes you just don’t need the speed. When you’re just blinking LEDs on a human timescale, the general-purpose Arduino functions are good enough. I’ve written loads of useful firmware that fits this description. When the timing requirements aren’t tight, slow as dirt can be fast enough.

But eventually you’ll want to build a project where the old slow-speed pin toggling just won’t cut it. Maybe it’s a large LED matrix, or maybe it’s a motor-control application where the loop time really matters. Or maybe it’s driving something like audio or video that just needs more bits per second. One way out is clever coding, maybe falling back to assembly language primitives, but I would claim that the right way is almost always to use the hardware peripherals that the chipmakers gave you.

For instance, in the end of the video linked above, the hacker wants to drive a large shift register string that’s lighting up an LED matrix. That’s exactly what SPI is for, and coming to this realization makes the project work with timing to spare, and in just a few lines of code. That is the way.

Which brings me to the double-edged sword that the Arduino’s abstraction creates. By abstracting away the chips’ hardware peripherals, it makes code more portable and certainly more accessible to beginners, who don’t want to learn about SPI and I2C and I2S and DMA just yet. But by hiding the inner workings of the chips in “user friendly” libraries, it blinds new users to the useful applications of these same hardware peripherals that clever chip-design engineers have poured their sweat and brains into making do just exactly what we need.

This isn’t really meant to be a rant against Arduino, though. Everyone has to start somewhere, and the abstractions are great for getting your feet wet. And because everything’s open source anyway, nothing stops you from digging deeper into the datasheet. You just have to know that you need to. And that’s why we write up videos like this every five years or so, to show the next crop of new hackers that there’s a lot to gain underneath the abstractions.

This article is part of the Hackaday.com newsletter, delivered every seven days for each of the last 200+ weeks. It also includes our favorite articles from the last seven days that you can see on the web version of the newsletter. Want this type of article to hit your inbox every Friday morning? You should sign up!

Nuvoton Launches 4th Generation Gerda HMI Display ICs for Automotive Safety and UX

Nuvoton Launches 4th Generation Gerda HMI Display ICs for Automotive Safety and UX

Nuvoton Technology Corporation Japan (NTCJ) has started mass production of its 4th-generation Gerda HMI display ICs, available in three variants.

Abhishek
Circuit Digest 23 May 11:31

OpenAI and Jony Ive Partner on Screenless AI Companion to Replace Traditional Interfaces

OpenAI and Jony Ive Partner on Screenless AI Companion to Replace Traditional Interfaces

With the intent to completely change the consumer electronics landscape, OpenAI CEO Sam Altman has reportedly shared plans to launch 100 million AI-powered devices designed in collaboration with former Apple designer Jony Ive. The announcement follows OpenAI’s acquisition of io, an AI startup co-founded by Ive, said to be valued at $6.5 billion. 

Abhishek
Circuit Digest 23 May 08:42

India Poised for Growth in Semiconductor Research as Manufacturing Lags Says MediaTek

India Poised for Growth in Semiconductor Research as Manufacturing Lags Says MediaTek

David Ku, MediaTek's Co-Chief Operations Officer, acknowledges India’s growth in semiconductor research and development while cautioning that the nation is still years from becoming a prominent semiconductor manufacturing hub. Speaking during a media interaction in Taipei, Ku drew attention to the steep learning curve and extended timelines tied to semiconductor fabrication.

Abhishek
Circuit Digest 23 May 06:34

TSMC Declines India’s Factory Proposal as Nation Launches 3nm Chip Design Centers

TSMC Declines India’s Factory Proposal as Nation Launches 3nm Chip Design Centers

Taiwan Semiconductor Manufacturing Company (TSMC), the global leader in semiconductor fabrication, rejected invitations to set up foundries in India, Singapore, and Qatar. Although the company did not share reasons, analysts point to the lack of a mature semiconductor supply chain. Historically, TSMC has leaned towards locations with a strong existing ecosystem and infrastructure.

Abhishek
Circuit Digest 22 May 08:07

TSMC Declines India’s Factory Proposal as Nation Launches 3nm Chip Design Centers

TSMC Declines India’s Factory Proposal as Nation Launches 3nm Chip Design Centers

Taiwan Semiconductor Manufacturing Company (TSMC), the global leader in semiconductor fabrication, rejected invitations to set up foundries in India, Singapore, and Qatar. Although the company did not share reasons, analysts point to the lack of a mature semiconductor supply chain. Historically, TSMC has leaned towards locations with a strong existing ecosystem and infrastructure.

Abhishek
Circuit Digest 22 May 08:07

ROHM Expands NIR LED Lineup with Miniature Models for VR, Industrial, and Medical Use

ROHM Expands NIR LED Lineup with Miniature Models for VR, Industrial, and Medical Use

ROHM announced the launch of a new series of compact surface-mount near-infrared (NIR) LEDs, designed to meet the surging demand for precise, power-efficient sensing in contemporary applications such as VR, AR, automation systems, and biosensors.

Abhishek
Circuit Digest 22 May 07:32

DigiKey Introduces Digital Technology Portals to Drive Education and Innovation in APAC Region

DigiKey Introduces Digital Technology Portals to Drive Education and Innovation in APAC Region

THIEF RIVER FALLS, Minnesota, USA — DigiKey, a leading global commerce distributor offering the largest selection of technical components and automation products in stock for immediate shipment, introduces dedicated Application & Technology Portals in the AP

Staff
Circuit Digest 21 May 06:29

The Mouse Language, Running on Arduino

Although plenty of us have our preferred language for coding, whether it’s C for its hardware access, Python for its usability, or Fortran for its mathematic prowess, not every language is specifically built for problem solving of a particular nature. Some are built as thought experiments or challenges, like Whitespace or Chicken but aren’t used for serious programming. There are a few languages that fit in the gray area between these regions, and one example of this is the language MOUSE which can now be run on an Arduino.

Although MOUSE was originally meant to be a minimalist language for computers of the late 70s and early 80s with limited memory (even for the era), its syntax looks more like a more modern esoteric language, and indeed it arguably would take a Python developer a bit of time to get used to it in a similar way. It’s stack-based, for a start, and also uses Reverse Polish notation for performing operations. The major difference though is that programs process single letters at a time, with each letter corresponding to a specific instruction. There have been some changes in the computing world since the 80s, though, so [Ivan]’s version of MOUSE includes a few changes that make it slightly different than the original language, but in the end he fits an interpreter, a line editor, graphics primitives, and peripheral drivers into just 2KB of SRAM and 32KB Flash so it can run on an ATmega328P.

There are some other features here as well, including support for PS/2 devices, video output, and the ability to save programs to the internal EEPROM. It’s an impressive setup for a language that doesn’t get much attention at all, but certainly one that threads the needle between usefulness and interesting in its own right. Of course if a language where “Hello world” is human-readable is not esoteric enough, there are others that may offer more of a challenge.

New Doors Open for Indian AI Startups as US Eases Chip Export Rules

New Doors Open for Indian AI Startups as US Eases Chip Export Rules

Thanks to a major policy change in the United States, Indian startups and researchers may soon find it easier to access cutting-edge AI hardware. The US government has officially scrapped the controversial AI diffusion rule introduced under the Biden administration.

Abhishek
Circuit Digest 20 May 07:32