Monthly Archives: May 2021

A remote-controlled Arduino Nerf tank

via Arduino Blog

Arduino Nerf Tank

Makers love Nerf guns, but Nathan Li takes foam-based home security to a new level with his mini Nerf tank. Naturally there’s an Arduino Uno in there, powering the mobile dart launcher.

Scruffy lookin’ Nerf tank herder

This miniature roving robot, known as M.A.T. (Modular Arduino Tank), is beautifully built. Not only is it remarkably accurate, but the dart launching mechanism is a triumph of non-lethal weapon design.

Unlike the majority of Nerf mods out there, this tank doesn’t actually use any parts from a toy gun. Attached to the front of the dart turret is a pair of flywheel motors. These spin the flywheels in opposite directions, at a pretty fast rate. An arm mounted on a servo feeds a dart into the flywheels, which propel it at an impressive lick!

The next dart is gravity fed, and simply falls into place, making it quite a rapid firing micro tank.

Testing the tank

Li takes his tank through a series of batteries, all of which show impressive results. Accuracy is spot on, which isn’t easy with notoriously unreliable Nerf darts. A five-foot muzzle velocity test achieves a whopping 35MPH dart speed. The distance test sends foam projectiles an impressive 44 feet.

Then there’s a demonstration of some excellent grouping in the accuracy test.

It’s sparked up a whole conversation over on Reddit about how the firing mechanism can be modified. The flywheel thrower operates much like baseball launchers (and this dog toy, for example), which has really captured the maker community’s imagination. Shooting dried peas seems to be a popular idea. As does the idea of building in object detection for pest control.

The maker has shared his Arduino code on GitHub. You can also find the 3D print files and a build guide on Li’s website.

The post A remote-controlled Arduino Nerf tank appeared first on Arduino Blog.

Arduino Cloud now supports ESP32 devices

via Arduino Blog

Arduino Cloud now supports ESP32

Support for ESP32 devices is now available on the Arduino IoT Cloud. It’s a huge step forward in bringing IoT devices of all kinds together, and giving them a way to get connected, communicate with each other, and offer new levels of convenience and control.

A new world of IoT connectivity

Arduino’s been working on this for some time, and we’re really excited to introduced ESP32 support by including the Arduino Core developed by Espressif on the Arduino Cloud platform. This opens up cloud-connected projects to a whole new world of IoT devices, projects and possibilities. Web Editor is by far the most convenient way to program an ESP32, and to connect it and control it via a cloud platform.

Support for ESP8266 devices is already available, and was recently moved into the free Arduino Cloud tier. The addition of ESP32 boards, along with the wide range of Cloud-compatible Arduino devices, adds some serious power to a Cloud account.

It’s all about communication. There’s never been an easier way to program your boards, or implement device-to-device communication in IoT. Once your devices are hooked up to an IoT Cloud account, they can talk to each other, sync variables, share data and be combined into powerful dashboards. You even get seamless smartphone control through the Arduino IoT Remote apps. Or if you just want a simpler, easier way to program your ESP32 boards, the Arduino Cloud Web Editor makes it a walk in the park.

It’s the next step in making Arduino Cloud into a secure, ubiquitous platform for all connected devices. It’s still early days, but that’s where the community comes in. We want you guys to get on there, hook up your boards, and test the limits of what’s possible in Cloud-connected projects.

Connect Your ESP32 to the Cloud

There are only a couple of things you need to get an ESP32 board onto Arduino Cloud.

An account on the Arduino IoT Cloud, of course. You’ve got multiple options, so plenty of ways to tailor the subscription to exactly what you need. Get started with the free plan, and then just bump it up to the next level once you’re ready.

Arduino Cloud Plans

Grab the Arduino Create Agent, which runs in the background on your computer. It lets Arduino IoT Cloud detect and communicate with supported boards. It makes it a doddle to upload sketches from your web browser using the Web Editor IDE, as well as read and write data.

Note: It’s possible your computer might need drivers to recognize your ESP32 board on the serial port. If you’re having difficulties, check in with the board manufacturer to get the necessary drivers.

And then you’re good to go! Follow the Arduino IoT Cloud process just as you would with any other board. Create a device, select “ESP32 device”, and take note of your secret key during this setup process.

Your contribution and tests will really help to build on this exciting evolution of Arduino IoT Cloud. So we want to hear all about it. Join us over on the forum to share your experiences.

This is a great way to upgrade existing projects, home automation or other applications. It makes it so easy to take advantage of IoT Cloud’s powerhouse features. With almost no code, you can have any combination of Arduino, ESP8266 and ESP32 boards communicating and working together seamlessly and wirelessly. It’ll cut the time it takes to build adventurous new projects while expanding the possibilities and significantly reducing the legwork.

Once you’re in the Cloud, there’s no looking back!

The post Arduino Cloud now supports ESP32 devices appeared first on Arduino Blog.

A Barcode Scanner Darkly

via SparkFun: Commerce Blog

Welcome back, everyone! It's Friday and that means new products - this week we have six! Our new 2D Barcode Scanner Breakout is able to detect 20 different 1D and 2D codes and can connect via a simple USB-C interface. Next up, announced on Monday, we have Raspberry Pi's new PoE+ HAT available for pre-order. Last up this week, we have four new cables that can really improve your breadboard efficiency. Now, let's jump in and take a closer look!

Holy Star-Spangled Scanner, Batman!

SparkFun 2D Barcode Scanner Breakout

SparkFun 2D Barcode Scanner Breakout

SEN-18088
$49.95

The SparkFun 2D Barcode Scanner Breakout is a nifty little breakout board featuring the DE2120 barcode scanner module from DYScan. The DE2120 reads 20 different barcode symbologies (both 1D and 2D) using a camera coupled with on-board image processing to identify and decode everything from UPC codes to QR codes. The module also features two LEDs: one for illumination and one to project the red line that you're used to seeing from laser-based scanners.


Raspberry Pi PoE+ HAT

Raspberry Pi PoE+ HAT

DEV-18346
$20.00

The Raspberry Pi PoE+ HAT is designed to replace the existing Raspberry Pi PoE HAT in all new and existing designs. Like the original, the PoE+ HAT allows you to power your Raspberry Pi using Power over Ethernet networks. The PoE+ HAT meets all the requirements of the IEEE 802.3af (802.3at Type 1, PoE+) specifications. This ups the power the network can supply from 15.4 watts (PoE) to 25.5 Watts (PoE+) over CAT5 cable.

The Raspberry Pi PoE+ HAT is available for pre-order and does not include a Raspberry Pi. Orders are expected to be fulfilled by late June and in the order they are received.


Breadboard to GHR-05V Cable - 5-Pin x 1.25mm Pitch

Breadboard to GHR-05V Cable - 5-Pin x 1.25mm Pitch

CAB-18078
$0.75
Breadboard to GHR-06V Cable - 6-Pin x 1.25mm Pitch

Breadboard to GHR-06V Cable - 6-Pin x 1.25mm Pitch

CAB-18079
$1.15
Breadboard to JST-ZHR Cable - 4-pin x 1.5mm Pitch

Breadboard to JST-ZHR Cable - 4-pin x 1.5mm Pitch

CAB-18080
$0.95
Breadboard to JST-ZHR Cable - 6-pin x 1.5mm Pitch

Breadboard to JST-ZHR Cable - 6-pin x 1.5mm Pitch

CAB-18081
$1.25

We wrap up the day with these new breadboard-friendly JST cables. Whether you need a 5-pin, 1.25 mm pitch GHR-05V, 6-pin, 1.25 mm pitch GHR-06V, 4-pin, 1.5 mm pitch JST-ZHR, or 6-pin, 1.5 mm pitch JST-ZHR cable, we have you covered!


That's it for this week! As always, we can't wait to see what you make! Shoot us a tweet @sparkfun, or let us know on Instagram or Facebook. We’d love to see what projects you’ve made! Please be safe out there, be kind to one another, and we'll see you next week with even more new products!

Never miss a new product!

comments | comment feed

Wake Up to your Own Personalized IoT

via SparkFun: Commerce Blog

There are times when every original intention you had for a blog post winds up on the cutting room floor. This is one such post. It began simply enough - discuss the Internet of Things, create a project, share the project, eat some pie. But the further I got with my project, the deeper I dug, and the further down the rabbit hole I found myself.

The project idea is simple enough - make a device that listens for a keyword or wake word(s), and when it hears it, executes some simple code, sending a command to some other device. There are devices from major companies that do this, and millions of people have them, so why don’t I just buy one of those?

You’ve met me, right?

THE BIG THREE

alt text
Of the three major players in the Smart Speaker market, guess which one is customizable...

For most people, there are three ways to verbally access the Internet of Things. You either say “hey Google,” “hey Siri,” or “Alexa”. But what if you want to change your wake word? Well, if you have a Nest Hub, you could change your wake word to “OK Google.” On an apple device you could switch from “hey Siri” to “OK Siri.” But what if you have an Amazon Echo? Well, the world’s your oyster my friend! You have the freedom to change your wake word to any word you choose, just as long as the word you choose to change it to is either “Amazon,” “Echo” or “computer.”

Now admittedly that last one is great if you want that Star Trek feel around your home, but none of these devices come anywhere near what I would call customizable. I want a device that allows me to set any wake word I want, or even any command word I want. None of this is going to be possible on any of the aforementioned devices, but with a Raspberry Pi and some Python code, you control the wake words, the control words, and pretty much any verbal input you want. Want the name of your estate to be a keyword? No problem. What about your favorite toy from when you were a kid? Or that classmate you had a crush on in third grade? It’s all possible now.

So many options

Having worked with Pete Warden at the ARM AIoT Dev Summit, presenting a session on building a Harry Potter-esque wand using TensorFlow Lite (back when we were traveling and attending events), I knew that chapter 7 of Pete’s book TinyML focused entirely on wake word detection. Having worked with TensorFlow, I also knew that it took quite a bit of time to train a model, and works best using multiple voices to gather audio samples for training.

TensorFlow definitely yields solid results, but I wanted something simpler and less time consuming, so I started hunting around. I knew that I could probably use a speech-to-text service like Google Speech-to-Text, Microsoft Azure Speech, or IBM Watson Speech to Text, but I didn’t want to have to worry about a streaming API. Further down the rabbit hole.

While I know there are more options, I looked into three wake word engines - PocketSphinx, Carnegie Mellon University's open source, large vocabulary, speaker-independent continuous speech recognition engine; Kitt.ai’s hotword detector package Snowboy; and from Picovoice.ai, their wake-word engine Porcupine. All come with pros and cons, and here’s what I learned.

How much time (and how many friends) do you have?

For custom word recognition, training your model(s) will be compulsory, and can be incredibly time consuming. In CMU’s Sphinx training tutorial, they require a full hour of audio data for command and control usage by a single speaker. If your application is going to require command and control usage by multiple people, you’ll need five hours of audio data provided by two hundred separate speakers.

For Snowboy’s Hotword Creator, you only need five hundred of your closest friends to record three samples each. If I can’t muster two hundred people to help me build a wake word for PocketSphinx, chances are slim to none that I’ll be able to come up with two and a half times that many to help me out with Snowboy.

That leaves Porcupine. Apparently PicoVoice’s mantra seems to be “No friends? No problem!” The PicoVoice console simply asks you to type in a wake word phrase, choose a language from the four they offer (English, French, German or Spanish), and hit the “Train Wake Word” button. In about three hours you’ll receive an email letting you know that you can download your data set. However, even before it’s completed, you can test it on the console. I was amazed and how well and how quickly my phrase was recognized.

CPU usage

CPU usage varied quite a bit between the three engines. PocketSphinx, arguably the most flexible of the three, was also the hungriest. Snowboy sat on the high side of center, and Porcupine came in at just 12 percent of what PocketSphinx used.

alt text
When it comes to your wake word engine's CPU usage, less is definitely more.

AUCURACY IS IMPERTANT

What good is speech recognition if your speech isn’t being recognized? False positives and negatives greatly affect performance, and when benchmarked, the results also swung fairly broadly.

alt text
The lower the miss rate, the better (and more impressive) the final project.

Full disclosure, these findings were based on tests run by PicoVoice, so one might think that the results might be skewed, like drug side-effect studies paid for by the manufacturer of the drug. However, they are completely transparent in their methodology, and I was able to find comparable results when the engines were tested by Rhasspy.

AND THE WINNER IS…

Having been created in an educational setting, PocketSphinx is more than just a speech to text engine, it is a research system, so it will most likely continue to improve and expand. For an educational entity, it definitely should not be overlooked. As far as Snowboy is concerned, it is a decent engine, however, KItt.AI announced early last year that they would be shutting down all of their products as of December 31st, 2020. It remains in their Github repository, and can still be used and improved, but any support is now purely community-based. With it’s low CPU usage and extremely high accuracy, PicoVoice’s Porcupine is the engine I chose to use for my project. That being said, there are still some things to be aware of if you decide to use Porcupine for any IoT projects. First, you’ll need to create an account with PicoVoice. I know that there can be some aversion to that, but isn’t that what your Yahoo account is for? Then there’s the decision that comes with your account. PicoVoice offers two options for your account - you can create a Personal Account or an Enterprise Account. Speech models created with a Personal Account cannot be used for any commercial applications. This account type is designed for researchers, hobbyists, tinkerers, and educators. Additionally, wake words created with a Personal Account expire after thirty days. By contrast, an Enterprise Account allows for commercial use and distribution, and the wake words do not expire. However, if you’re a small startup or single-employee company, the $400/month (charged annually) might be a bit steep, but it is important to note that they do offer a “Startup Discount”.

alt text
Using the PicoVoice Console, you can create new wake words simply by typing them into the Phrase field.

MY IoT PROJECT

After all of this digging and researching, I have to say I’m very happy with Porcupine as a wake word engine for my project. Oh right, my project… My IoT project blog post will have to wait for another day, but do stay tuned, as this potential money-making project, which is definitely not a cryptocurrency harvester, promises to be much more fun than training a custom wake word for five hours! And if a bit more research on the front end can yield a more efficient project on the back end, then I believe that it's time well spent.

comments | comment feed

Wikirace, MicroMod Style

via SparkFun: Commerce Blog

Have you ever heard of the Wikirace? It's a popular way to pass time by using links to travel from one Wikipedia page to another.

alt text

Basically, one of the best parts about using Wikipedia is how vast it is...you could look up one topic, and in trying to understand that topic have to learn about a half a dozen other topics within Wikipedia. This is all done through Wikilinks, or the internal links that connect topics. The premise of the Wikirace is to see really how vast Wikipedia actually is, and try to connect two completely unrelated topics to each other in as few 'clicks' as possible. You can play the game yourself, or you could build a bot to do it for you as quickly as possible.

It's especially fun to build this kind of bot if you like to nerd out on data structures, because it's essentially a breadth-first search algorthim. A breadth-first search algorithm is effective for searching tree or graph data structures - it explores all of the neighbor nodes at the immediate depth level before viewing any node on the next depth level.

alt text

Building a Wikirace bot on a microcontroller seems like a fun challenge, so let's see how the build goes!

The Build

This kind of bot can be built through Python, and I'm a mega fan of Python due to its ease of use and endless libraries. So naturally, the easiest conversion to build this out on a microcontroller is to use MicroPython, which has most of the great features of Python through a small subset of the Python standard library.

Plus, I want to use a display to count the number of Wikilinks visited throughout the race and what they are. It seems to be an prime opportunity to utilize the brand new RP2040 MicroMod Processor and the Input and Display Carrier board. As with all MicroMod projects, the hardware hookup is super simple - it just takes inserting the special keyed M.2 connector of the processor board into the carrier board and gently screwing it in.

SparkFun MicroMod RP2040 Processor

SparkFun MicroMod RP2040 Processor

DEV-17720
$11.95
SparkFun MicroMod Input and Display Carrier Board

SparkFun MicroMod Input and Display Carrier Board

DEV-16985
$59.95
3

The Code

I had to import some libraries directly into the MicroPython to access the Wikipedia pages. Otherwise, the code takes a root and target page, and completes breadth-first search to go through Wikipedia to connect the two.

import os, sys, wikipedia


def print_path(data):
    if data['parent']:
        print_path(data['parent'])
        print(' => ', end='')
    print(data['title'], end='')


def get_page(selection):
    page = None
    while not page:
        try:
            entry = input('%s page title: ' % selection)
            page = wikipedia.page(entry)
        except wikipedia.exceptions.DisambiguationError as e:
            print('\nDisambiguation Selection (Choose one of these or use another term)')
            for option in e.options:
                print('\t' + option)
            print()
        except wikipedia.exceptions.PageError as e:
            print('Page error, try again.')
        except KeyboardInterrupt:
            print('Exiting')
            sys.exit()
    return page


def wikipedia_game():
    # Clears up the screen on start.
    os.system('cls' if os.name == 'nt' else 'clear')
    print('Wikipedia Game\n\n')
    root_page = get_page('Root')
    target_page = get_page('Target')
    G = {}
    G[root_page.title] = {
        'title': root_page.title,
        'distance': 0,
        'parent': None
    }
    Q = [G[root_page.title]]
    print('\nFinding the shortest path between the %s and %s pages...' % (root_page.title, target_page.title))
    while Q:
        current = Q[0]
        Q = Q[1:]
        try:
            current_page = wikipedia.page(current['title'])
            print('\t%s' % current_page.title)
            for link in current_page.links:
                if link not in G:
                    G[link] = {
                        'title': link,
                        'distance': current['distance'] + 1,
                        'parent': current
                    }
                    if link == target_page.title:
                        print('\n%s found!' % link)
                        print('Path: ', end='')
                        print_path(G[link])
                        print()
                        sys.exit()
                    Q.append(G[link])
        except wikipedia.exceptions.DisambiguationError as e:
            # Disambiguation Page
            G[e.title] = {
                'title': e.title,
                'distance': current['distance'] + 1,
                'parent': current
            }
            # Adds every link on disambiguation page to queue
            for option in e.options:
                if option not in G:
                    G[option] = {
                        'title': option,
                        'distance': current['distance'] + 2,
                        'parent': G[e.title]
                    }
                    if option == target_page.title:
                        print('\n%s found!' % option)
                        print('Path: ', end='')
                        print_path(G[option])
                        print()
                        sys.exit()
                    Q.append(G[option])
        except wikipedia.exceptions.PageError as e:
            # Skips over the item in the queue if it results in a page error.
            print('\tSkipping %s...\n\t\t%s' % (current['title'], e))
        except KeyboardInterrupt:
            print('Exiting')
            sys.exit()


wikipedia_game()

Obviously, there's an immediate issue with this code running on the RP2040 - I need Wifi to access Wikipedia in the first place. But it's okay that I wrote this up in MicroPython, because the ESP32 Processor board also works with MicroPython and has WiFi capabilities. So I can swap it out real quick and run it through a different processor board.

SparkFun MicroMod ESP32 Processor

SparkFun MicroMod ESP32 Processor

WRL-16781
$14.95

The End Result

The end result is that I can provide the bot a starting and ending Wikipedia page, and it can count how many Wikilinks it visited and what they were and display it on the Input and Display Carrier board. I looked up a random page on Wikipedia (Montesarchio), and ran it to see if I could get to tree. These were the following steps it took: Montesarchio, Western Roman Empire, Africa, Oil Lamp, Walnuts, Tree. I suppose the next step is to race the bot itself...

comments | comment feed