Posted on

Scrolling LED Sign Kits Are Now Available

What is it?

Scrolling LED Sign kit V1.0
Scrolling LED Sign kit V1.0

The Scrolling LED Sign kit is an Arduino-powered scrolling LED sign using NeoPixel LED strips. Big, bright messages can be extended long as you want it. This kit lets you connect your Arduino Nano to the popular NeoPixel/WS2812B LED strips. You will also need an external, regulated +5VDC power supply if you use more than around 300 LEDs in your sign.

Why Do It?

Animated GIF of glowy LED strip
Animated GIF of glowy LED strip

You know you want a bunch of bright, colorful LEDs shouting out your message for all kind, sensitive and literate beings to see. This is a fun and very eye-catching project. Grab all the attention with this gorgeous, colorful sign.

Benefit/Value

Store-bought LED signs are expensive and hard to program. You can make this sign a big or as small as you like. Go wild with colors and get your message seen by lots of folks, assuming they can 1) see and 2) read.

Dale's Scrolling LED Sign
Dale’s Scrolling LED Sign, shown with additional components not included with the kit

Who Benefits?

Electronic hobbyists love to build attention-getting projects. Venue operators like to be able to disseminate information in an attractive and mesmerising way. Clubs and groups will stand out with their super-bright, super-colorful signs.

Specifications:

The Scrolling LED Sign kit requires the following additional components, not included with the kit:

  • Arduino Nano
  • NeoPixel/WS2812B LED strips with attached header pins
  • USB cable to power and program the Arduino Nano
  • External regulated +5VDC power supply (if you use more than 300 or so LEDs)
  • Something wide and flat to mount the LED strips and driver board

More Details About the Project/Product Transisiton

I’ve written a detailed blog post about how this product came to be. It started out as a project for my friend and inspiration Brady Pamplin, which is why you sometimes see it referred to as “Brady’s Scrolling LED Sign”.

Posted on

Arduino (Articles) on My Mind

Writing More about Writing More Arduino Articles

Since my main theme for 2020 is Writing, I’m assigning myself a much larger number of writing jobs. In fact, just telling you this is helping me achieve one of my writing goals! Approaching writing as a project can get a bit meta. I’m still happy to be writing about writing, and looking forward to writing about Arduino.

Some Arduino Project Updates!

This week I have not one but two (!) projects that involve writing more about Arduino. The first project is about Brady’s Scrolling LED Sign, based on the Arduino Nano. The second project is a more in-depth, hands-on article about the new RISC-V chips from GigaDevice.

Scrolling LED Sign – A Good Application for an Arduino

Brady's Scrolling LED Sign PCB
Brady’s Scrolling LED Sign PCB

I have been working on the Scrolling LED Sign project for the last few months, and I’m at the point where it seems prudent to share some of the background and details of this project. The original project by Josh Levine also used an Arduino UNO, but Josh suggested that the Arduino Pro Mini model would also work at a lower cost.

To find out how we ended up using the Arduino Nano, you’ll just have to read the project post.

RISC-V & Arduino… Wait, what?

My second writing project (Hands on With RISC-V, Part 1 – An Introduction) might be a bit of a head-scratcher. What has this cutting-edge technology have to do with Arduino? Generally speaking, I consider myself “an Arduino cheerleader, but not an Arduino shareholder”. I still firmly believe that Arduino has its place in the Grand Order of Things. Arduino is useful because it’s easy. Projects get up and running quickly and people build their enthusiasm and fuel their future investigations. However, a drawback of Arduino is that it’s very simple, and it’s this simplicity that I find limiting.

Does this mean that I am somehow “anti-Arduino”? Not at all. That would be like saying I was “anti-ketchup”, because it’s good with some things and not so much with others. As I said, I think Arduino has its place.

I plan to use the Arduino IDE in a hands-on investigation of the Sipeed Longan Nano. It’s a small and inexpensive development board from Seeed Studios which uses a new RISC-V chip from GigaDevice (part #GD32VF103CBT6). There seems to be a great deal of interest in these new chips. This makes me want to show you some of the ways I’ve been able to bend it to my will.

Stay tuned for more updates – see you in the future!

Posted on

Hands On with RISC-V, Part 1 – An Introduction

What is RISC-V?

Everyone (including me) is excited about RISC-V these days, but what exactly is it? How can I get started learning more about it? My favorite way to find out these things is to dive into the deep end of the pool and just start playing with it. In this series of articles, I will show you what I’ve done and show you how you can get started, too.

Once the surface of the Earth cooled, then the oceans formed… No, wait, let’s back up. RISC (without the Roman numeral for “5” suffix) is an acronym for Reduced Instruction Set Computer. An instuction set defines the commands that a particular device can execute. Due to the imprecise nature of English noun modifiers, there was once debate over whether this meant the instructions themselves were reduced or the instruction set as a whole was reduced. In reality, both viewpoints are valid. These computers were built in the 1980s, such as Sun Microsystems’ (& Fujitsu’s) SPARC and IBM’s PowerPC.

RISC-V logo
RISC-V logo

RISC-V (pronounced as “risk five”) is an open-source hardware instruction set architecture. Born as a research project at the University of California, Berkeley in 2010, the idea was to produce a practical design with applications in business, science and industry; not just another academic exercise. Given a complete specification for a computer’s instruction set, one can then theoretically build one, assuming a lot of other things fall into place. Being a free and open-source project, anyone with the interest and wherewithal can manufacture their own computer chips and related devices, without having to pay licensing fees to the original developers. With annual consumption of such devices now in the billions of chips every year, perhaps you can start to understand the attendant interest from many sectors.

The RISC-V Foundation was started in 2015 to maintain and publish the specification and related documents for the architecture. This is the place to go to get the final (yet evolving) word on all things RISC-V. In November 2019, the foundation announced that they would be moving their headquarters from Delaware in the US to Switzerland, citing concerns over potential geopolitcal disruption.

Actual Chips You Can Buy Now

The first commerically available silicon implementing the RISC-V arcitecture was produced by SiFive in 2017. Their FE310 (“Freedom Everywhere”) device has an E31 Core that runs at 320 MHz. It is also available in Arduino form factor as the HiFive1. This won’t be the last time we talk about Arduino in this series.

Several other vendors are now producing parts in a variety of capabilites, including Western Digital and GigaDevice. We’ll be looking at one of GigaDevice’s offerings in more detail.

Specific Example: The Sipeed Longan Nano

Sipeed Longan Nano from Seeed Studios
Sipeed Longan Nano from Seeed Studios

First spied in late August 2019 on the CNX Software blog, the Sipeed Longan Nano from Seeed Studios seemed too good to be true. I mentioned it to my friend and fellow robot enthusiast David Ackley. For only “$4.9”, they promised a RISC-V microcontroller by GigaDevice, the GD32VF103CBT6, with 128K of flash memory and 32K of SRAM, a color LCD and clear arcylic enclosure. Unfortunately, it was a “pre-order”, with the expectation of shipping on 13 October 2019. I was about to place an order, then backed out. Bolder David, on the other hand, went for it.

The expected shipping date slipped to 31 October 2019, but I eventually relented and placed an order for five (5) of the little beasties. With expedited shipping via DHL, the total came to just under $50. Luckily for me, Hyundai had been offering $50 gift cards to anyone who would take a test drive, so things just kind of lined up there.

Can’t Get There From Here

The Sipeed Longan Nanos shipped ahead of the final expected shipping date. Yay! Sadly, DHL dropped the ball. Once “out for delivery”, I got a message to “Contact DHL and update my address”. My house has been here for 20 years; no update needed. DHL has made several deliveries here in the past. After several phone calls to customer service, I told them to just hold the package in their Carrollton TX facility and I would pick them up on my next trip into town. You might like to know that the next DHL delivery from China suffered the same symptoms. This time I held my ground and steadfastly refused to let them fail, through an absurdly large number of phone calls to DHL customer service. Now (or again) they know the way.

Actual Hands On Actual Hardware

Now that I had working hardware in the lab, it was time to explore some of the finer details. The GD32VF103CBT6 specifications sounded oddly similar to the STmicroelectronics STM32F103CBT6, their medium-density performance line of ARM Cortex-M3 devices. It turns out that GigaDevice makes a line of devices that are “compatible” with ST’s offering. I’m not at all sure what their relationship is, exactly. However, it was a Good Thing because I was already quite familiar with the ‘F103, as it has been in production for over 12 years and is part of their 10 year longevity plan. While the core processor would be a RISC-V and not a Cortex-M3, the peripherals were almost identical. The two devices are also pin-compatible.

Sipeed Longan Nano with translucent case
Sipeed Longan Nano with translucent case

The enclosures that came with my five Longan Nanos were not the same as those pictured on the Seed Studios web site. Instead of crystal clear acrylic, they are of some softer, diffuse, translucent material. Two button caps fit inside the enclosure to activate the two PCB-mounted push buttons (BOOT and RESET).

The first hurdle I had to overcome was quite basic: USB-C. While I have boxes (and boxes) of USB cables here in the lab, not a one of them was the new-fangled USB-C type. Perhaps I’m not buying new phones often enough. Never fear! Amazon Prime* is here! I bought a package of three (3) cables [product link], each 2 meters long, for $5.89, although the price as of this writing is $6.49. Honestly, paying for USB cables was a novel experience these days. I’m usually trying to find Good Homes for my excess.

*I very rarely use Amazon Prime, mostly due to concerns about sustainability, but in some situations the ultra-mega-convenience wins over my love of the Earth and its future inhabitants.

Pushing Ones and Zeros

Time to bend this thing to my will. I followed the detailed instructions on the Sipeed Longan Nano page to set up their recommended delevopment environment. To summarize:

  • Install Microsoft’s Visual Studio Code (VSCODE)
  • Install the PlatformIO IDE plugin
  • Install the GD32V platform definition
  • Import an example project
  • Set up the projet configuration file (platformio.ini)
  • Compile
  • Download (using DFU method)
  • Confirm successful process (note blinking LED)

This process works, but it is not what I would call exceedingly convenient. Perhaps it was because it was my first experience using VSCode as a stand-alone product or PlatformIO. However, I did spend some time with this setup. I was able to add a little bit to the example program and blink all three colors of the built-in LED. Here is the code:

// main.c
// part of "GD32V-blink" project
// 28 October 2019
// Dale Wheat
// https://www.dalewheat.com

#include "gd32vf103.h"
#include "systick.h"

/* BUILTIN LED OF LONGAN BOARDS IS PIN PC13 */
// green = PA1, blue = PA2

#define LED_RED_PIN GPIO_PIN_13
#define LED_RED_GPIO_PORT GPIOC
#define LED_RED_GPIO_CLK RCU_GPIOC
#define LED_GRN_PIN GPIO_PIN_1
#define LED_GRN_GPIO_PORT GPIOA
#define LED_GRN_GPIO_CLK RCU_GPIOA
#define LED_BLU_PIN GPIO_PIN_2
#define LED_BLU_GPIO_PORT GPIOA
#define LED_BLU_GPIO_CLK RCU_GPIOA

void delay_1ms(uint32_t count) {
    uint64_t start_mtime, delta_mtime;
    // Don't start measuruing until we see an mtime tick
    uint64_t tmp = get_timer_value();
    do {
        start_mtime = get_timer_value();
    } while (start_mtime == tmp);
    do {
        delta_mtime = get_timer_value() - start_mtime;
    } while(delta_mtime < (SystemCoreClock/4000.0 *count ));
}

void main(void) {
    /* enable the led clock(s) */
    rcu_periph_clock_enable(LED_RED_GPIO_CLK);
    rcu_periph_clock_enable(LED_GRN_GPIO_CLK);
    /* configure led GPIO port(s) */
    gpio_init(LED_RED_GPIO_PORT, GPIO_MODE_OUT_PP, GPIO_OSPEED_50MHZ, LED_RED_PIN);
    gpio_init(LED_GRN_GPIO_PORT, GPIO_MODE_OUT_PP, GPIO_OSPEED_50MHZ, LED_GRN_PIN);
    gpio_init(LED_BLU_GPIO_PORT, GPIO_MODE_OUT_PP, GPIO_OSPEED_50MHZ, LED_BLU_PIN);

    GPIO_BC(LED_RED_GPIO_PORT) = LED_RED_PIN; // red LED on
    GPIO_BC(LED_GRN_GPIO_PORT) = LED_GRN_PIN; // green LED on
    GPIO_BC(LED_BLU_GPIO_PORT) = LED_BLU_PIN; // blue LED on
    GPIO_BOP(LED_RED_GPIO_PORT) = LED_RED_PIN; // red LED off
    GPIO_BOP(LED_GRN_GPIO_PORT) = LED_GRN_PIN; // green LED off
    GPIO_BOP(LED_BLU_GPIO_PORT) = LED_BLU_PIN; // blue LED off

    while(1) {
        GPIO_BC(LED_RED_GPIO_PORT) = LED_RED_PIN; // red LED on
        delay_1ms(1000);
        GPIO_BOP(LED_RED_GPIO_PORT) = LED_RED_PIN; // red LED off
        GPIO_BC(LED_GRN_GPIO_PORT) = LED_GRN_PIN; // green LED on
        delay_1ms(1000);
        GPIO_BOP(LED_GRN_GPIO_PORT) = LED_GRN_PIN; // green LED off
        GPIO_BC(LED_BLU_GPIO_PORT) = LED_BLU_PIN; // blue LED on
        delay_1ms(1000);
        GPIO_BOP(LED_BLU_GPIO_PORT) = LED_BLU_PIN; // blue LED off
    }
}

// [end-of-file]

In the platformio.ini project configuration file, I specified upload_protocol = dfu to allow me to download (upload?) the resulting binary file to the device using the built-in DFU (Device Firmware Update) using USB. This requires a specific button-press sequence on the Longan Nano to enter this mode:

  • Press and hold the RESET push button
  • Press and hold the BOOT push button
  • Release the RESET push button
  • Release the BOOT push button

With a little practice, this maneuver can be accomplished using a single finger rolling motion: “Roll up to upload”. The bits & bytes get magically transported to the flash memory of the device and you should be rewarded with a beautiful and colorful explosion of LED light.

In Summary

Let’s take stock of what we have at this point. We have working hardware based on the RISC-V core that offers a number of built-in peripherals that are uncannily similar to the STM32 Cortex-M3 devices we all know and love. We have a working software development environment that includes a compiler and facility to program the hardware using only a USB-C cable. Most importantly, we have a blinking LED that proves we are the true and rightful masters of our domain. Pretty cool, yes?

Next Time

Yes, we have accomplished much here, but there remain loftier goals to which we should set our sights. Debugging would be nice. A more streamlined device-programming cycle would also be desirable. We’ll explore some other viable alternatives in Part 2 of this series. Stay tuned!

Posted on

Brady’s Scrolling LED Sign

How It Began

About a year ago, my friend Brady Pamplin W5LH was teaching a class at the Dallas Makerspace. Brady teaches a variety of Arduino and microcontroller-related classes. See his web site for a list of what’s available. This class was about how to use NeoPixel LED strips with Arduino. NeoPixels are addressable RGB (red, green and blue) LED chips. Most importantly, it is not hard to chain them together. He liked an article he read by Josh Levine about how to make a “Times Square” style scrolling sign. Josh’s article suggested you could make one as large as you wanted for around $15 a foot. Brady built one of these signs, and I helped him make a few small improvements.

A First Prototype

Brady's prototype Scrolling LED Sign
Brady’s prototype Scrolling LED Sign. Click for video.

Brady then quickly built his own prototype to show off the idea to his students. The main problem was that he would give away the individual LED strips to students after the class. Consequently, the sign was often out of operation until he could make more strips. He posted a short video of the sign in operation on his web site, along with its Arduino sketch.

Dale Gets Involved

Brady’s sign worked splendidly and was a very attention-getting item, indeed. The only thing he wanted to add was the ability to display static (i.e., non-scrolling) text. I volunteered to look at the Arduino sketch and possibly add some functions to display the static text.

Once I looked at the original sketch from Josh’s web site, I was immediately impressed with two aspects of the design. First, the software does not use a memory-hungry frame buffer. Instead, it decodes the bit patterns of the individual letters and symbols on the fly. This allows very long messages to be stored in the flash memory of the Arduino and not be limited to the relatively small amount of static RAM. Second, the design pumps out seven bitstreams in parallel using highly-optimzed assembler code. Each bitstream goes to the individual LED strips via separate GPIO output pins. Thus the performance-constrained Arduino can crank out fairly high frame rates. More advanced microcontrollers use DMA (direct memory access) peripherals to do the same trick.

Tweaking the Code

I added a new function, showText(), that specified the text to display and the color to use. It simply calls an existing function, sendString(), once instead of repeatedly in a loop which was how Josh achieved the scrolling action. The cli() function* disables hardware interrupts for the timing-critical section of code used to update the NeoPixels. The sei() function* re-enables the hardware interrupts afterwards.

* actually they are macros for the AVR assembly instructions CLI (clear global interrupt enable bit) and SEI (set global interrupt enable bit).

void showText(const char* p, uint8_t red, uint8_t green, uint8_t blue) {
   cli();
   sendString(p, 0, red, green, blue);
   sei();
}

This function would let you display a non-scrolling message for one second (1,000 milliseconds) by calling it like this:

showText("Sample", 0x40, 0x00, 0x00); delay(1000); // red

The problem with this approach is that it used up precious static RAM; one byte for each character in the passed string. Then I cooked up another version of the same function. I did so using C++’s function overloading feature. This used either strings that were declared as const (constant) or specified using the FlashStringHelper modifier.

 void showText(const __FlashStringHelper* p, uint8_t red, uint8_t green, uint8_t blue) { 
cli();
PGM_P p1 = reinterpret_cast(p);
while (1) {
unsigned char c = pgm_read_byte(p1++);
if (c == 0) break;
sendChar(c, 0, red, green, blue);
}
sei();
}

You can have multiple versions of the same function, in this case showText(), as long as they take different parameters. As you can see, I had to add some trickery in the code to get it to take a string straight out of the flash memory. Here are some examples of how it can be used:

static char test[] = "-TEST-";
showText(test, 0x40, 0x00, 0x00); delay(1000); // red only
showText(F("RED---"), 0x40, 0x00, 0x00); delay(1000); // red

A More Robust Hardware Design

Brady built the sign with a cardboard (ahem, corrugated paperboard) substrate and various kinds of tape. It used an Arduino Nano (Brady’s choice for his Arduino classes) and a solderless breadboard. There were various wires going hither & thither. While this certainly worked and was spectacularly eye-catching, it was not road-worthy. It really needed to be, because by now Brady was taking the sign to other events.

I suggested to Brady a partial solution to the issue: a custom printed circuit board (PCB) to hold everything together. This would eliminate a large number of vulnerable electrical connections (in the form of breadboard jumpers) and make it a little easier to transport the sign to various events. The idea sort of sat there for a month or two. Brady would occasionally ask how it was coming, and I would typically say it would be ready “in three weeks”. Finally, on 2 October 2019, I added this project to my “official” list of Things to Do.

Gathering Customer Requirements

Brady and I got together on 8 October 2019 to discuss and finalize a definitive list of requirements for the project. Over some tacos, we set out the major check-list items for the project:

  1. Arduino Nano based system, socketed
  2. +5V 4A 2.1mm power supply
  3. Right-angle 3 pin female headers for LED strips
  4. Square pixel aspect ratio
  5. 2 non-dedicated potentiometers with knobs for adjustments
  6. 4 mounting holes
  7. Leave USB cable path clear
  8. LED connectors on right-hand side of PCB
  9. Check data bit order (lowest row is D0/TX)

Proof of Concept

A preliminary schematic and PCB layout in EAGLE 7.7.0 had already been made. Making sure the design met all the customer requirements, I uploaded the design to OSH Park and got this nice board rendering. This I showed to Brady and he said it looked like it would work.

Schematic Diagram

Here is the schematic diagram of the circuit. Click the image to download or view the diagram as a PDF.

Brady's Scrolling LED Sign schematic
Brady’s Scrolling LED Sign schematic

Customer Green Light

Brady's Scrolling LED Sign PCB assembled prototype
Brady’s Scrolling LED Sign PCB assembled prototype

Since everything looked good so far, on 16 October 2019 I ordered three prototype PCBs from my favorite short-run PCB fabricator, OSH Park. On 31 October 2019, the prototype boards arrived. I built one and gave it to Brady for testing. I didn’t have enough LED strips on hand to test it completely here in the lab.

On 21 November 2019, I received the remaining parts I needed to finish the second prototype PCB that I had promised Brady. The board was delivered on 26 November 2019.

A Sign of My Very Own

Animated GIF of glowy LED strip
Animated GIF of glowy LED strip

With my one remaining prototype PCB in hand, I decided to build my own Scrolling LED Sign. I ordered a reel of NeoPixel-compatible WS2812B LEDs (5 meters, 60 LEDs per meter, 300 LEDs total) from Amazon [product link]. This was on 28 January 2020. The very next day, my order arrived. Gotta love Amazon Prime for this kind of stuff*. It even came with a “tester” device that drives the whole strip in a variety of patterns.

Since the nice, round number 300 does not divide evenly by 7, I cut up the five meter strip into six strips of 43 LEDs with one strip left over with only 42 LEDs. To plug into the sockets on the driver board, I soldered three-pin headers to the input ends of the seven strips.

*I very rarely use Amazon Prime, mostly due to concerns about sustainability, but in some situations the ultra-mega-convenience wins over my love of the Earth and its future inhabitants.

Even More Testing

Animated GIF of Brady's prototype Scrolling LED Sign
Animated GIF of Brady’s Dale’s prototype Scrolling LED Sign

Laying out the loose strips on my work table, I was able to upload a slightly modified sketch and test the sign as a whole. I adjusted the number of PIXELS to 43, which was larger than Brady’s original sign.

Mounting to an Artisan Substrate

Attaching the adhesive-backed LED strips to a large panel of copper-clad PCB material I had in the lab, I was able to connect everything together. I could have scrubbed the copper to get rid of the fingerprints, etc., but I decided to leave it as it was and in fact invite oxidation, which should result in a dramatic and lovely patina in time. Since a solid sheet of copper is that very last thing you want to rest your circuits on, I put some famous blue tape under the driver board to insulate it a bit.

Dale's Scrolling LED Sign
Dale’s Scrolling LED Sign

In Summary

Transitioning your friends to “customers” doesn’t always go well, in my experience. This experience turned out to be one of the delightful exceptions. Brady seems to be quite happy with his new signs, and I know I am. He is planning on installing one of his signs at Tanner Electronics to advertise his classes across the street at the Dallas Makerspace.

Additionally, I have created a new Scrolling LED Sign kit and added it to my web store. It’s also available at Tanner’s and BG Micro. Right now, you still need to bring your own Arduino Nano, LED strips and regulated +5VDC power supply to complete the build. I am working on sourcing all the bits to be able to offer a “complete” kit for this kind of sign. I’ll let you know when that’s available.