What is Arduino?

Arduino is an open-source prototyping platform based on easy-to-use hardware and software. Arduino provides an open-source and easy-to-use programming tool, for writing code and uploading it to your board. It is often referred to as the Arduino IDE (Integrated Development Environment).

The Arduino boards are able to read inputs – light, proximity or air quality on a sensor, or an SMS or Twitter message – and turn it into an output – activating a motor, turning on a light, publishing content online or trigger external events. You can tell your board?what?to do by writing code and uploading it to the microcontroller on it using the Arduino programming language (based on Wiring), and the Arduino Software (IDE), based on Processing.

Over the years Arduino has powered thousands of projects. Arduino has gathered around a community where beginners and experts from around the world share ideas, knowledge and their collective experience. There are thousands of makers, students, artists, designers, programmers, researchers, professionals and hobbyists worldwide who use Arduino for learning, prototyping, and finished professional work production.

Arduino was born at the Interaction Design Institute Ivrea IDII from the Wiring project as an easy tool for fast prototyping, aimed at students without a background in electronics and programming. The main objective of both projects is to make the process of working with technology and electronics easier. The Arduino board has evolved to adapt to new needs ranging from simple 8-bit boards to products ready for IoT applications. All Arduino boards are completely open-source, empowering users to build them independently and eventually adapt them to their particular needs. The software is open-source, and it is growing through the contributions of developers and the Arduino community worldwide.

There have been many similar projects, but none of them succeeded as well as Arduino has, due to how easy it is to use the software, and the affordability of the hardware. The Arduino software is easy-to-use for beginners, yet flexible enough for advanced users needs. It runs on Mac, Windows, and Linux.

 

Arduino boards are relatively inexpensive compared to other microcontroller platforms, ranging from 8-bit microcontrollers to IoT applications.

The Arduino Software (IDE) is easy-to-use for beginners, yet flexible enough for advanced users. For educators, it’s conveniently based on the Processing programming environment, students learning to program in Processing will be familiar with how the Arduino IDE works easily transferring their knowledge.

The Arduino software is published as open source tools, available for contribution by? programmers worldwide. The language can be extended through C/C++ libraries and ported to other hardware platforms.

The diagrams of the Arduino boards are published under a Creative Commons license, so experienced circuit designers can make their own version of the different modules, extending and improving them or simply learn how they are built. Novices can build breadboard versions of the board in order to understand how it works and save money.

 

ArduCAM USB Camera Shield Released

The?ArduCAM?USB camera shield is?a universal camera control board designed for both PCs and embedded systems like the Raspberry Pi, TI?Beaglebone, and similar products. It supports most parallel interface image sensors ranging from 0.3MP to 14MP, including both global and rolling shutter sensors. The camera is packaged with the software you need to put it to work on Windows and Linux systems?and??a?comprehensive SDK library is provided to support this.??This SDK is fully integrated with Python, which allows for direct integration of our cameras with your?OpenCV?based applications.

The plug and play USB control interface simplifies integrating the camera with a wide range of computer hardware. The ready to use SDK library and demo source code makes the software integration process straightforward and efficient. Users can make it work in minutes without writing a line of code. The broad range of modules?ArduCAM?supports, combined with support for formats like RAW, RGB, YUV, JPEG assures our users a successful outcome.

The?ArduCAM?USB camera shield joins our product line of shields that offer SPI/IC2 interfaces. The USB camera shield offers significant speed gains over the SPI camera shield, running at as high a frame rate as the USB2.0 480Mbps bandwidth allows which can?deliver??640_480(VGA at 60 FPS, through??4384_3228(14MP) at 2 FPS. By using a global shutter camera headboard such as the MT9V034/AR0134 together with USB camera shield, the user can achieve industrial level machine vision with our camera on a Raspberry pi without effort.

The?ArduCAM?is straightforward enough that it can be easily used with PCs and single board computers such as the Raspberry Pi and the?Beaglebone. In short, the?ArduCAM?brings a plug and play solution to digital cameras at the hardware level.

Second Generation ArduCAM Shields and Modules

Introduction
ArduCAM series camera shield is a universal camera control board for Arduino. It hides the complex nature of the camera and provides the plug and play camera control interface as well as the ready to use software source code library and demo code. User can make it works in minutes without writing a line of code. The ArduCAM supports variety camera modules from 0.3MP to 5MP with different format like RAW, RGB, YUV, JPEG and can be well mated with standard Arduino boards.
ArduCAM Shield V2 and ArduCAM-Mini-5MP-Plus are the second generation of ArduCAM products, they offers the improved performance and enhanced functions than the previous revisions. They not only can capture decent 5MP JPEG images, but also can do 5MP full resolution RAW image capture, which makes it to be the ideal solution for IoT and scientific image processing applications. Even more they can record short movie clips as well.
The ArduCAM is straightforward enough that it can be easily used with an Arduino, however this simple interface means that the ArduCAM is equally easily integrated with other single board computers such as the Raspberry Pi and the Beaglebone black. It isn?t just a camera for the Arduino, it?s a camera that because it can be easily interfaced to an Arduino, can be easily interfaced to any single board computer, either directly, or through an Arduino if needed for a larger system without exposed SPI/I2C busses. In short, the ArduCAM brings a plug and play solution to digital cameras at the hardware level.

 

 

Introducing Adafruit Feather

Wouldn’t it be great if, instead of collecting shields, HATs, PMODs, Clicks, Booster Packs, Props… you could have a cross-compatible platform? Something that doesn’t force you into one chipset? and allows you to mix-and-match the microcontroller, wireless protocol, and functional extensions?

Yeah, me too! That’s why I created Feather. Feather is a flexible and powerful family of microcontroller main-boards (Feathers) and daughter-boards (Wings) with a wide range of capabilities.

Feathers!

Since we aren’t tied to one chip manufacturer, we feature the best-of-the-market chipsets, including:

  • Atmel ATmega32u4 – 8 bit AVR
  • Atmel ATSAMD21 – 32 bit ARM Cortex M0+
  • Broadcom/Cypress WICED – STM32 with WiFi
  • Espressif ESP8266 and ESP32 – Tensilica with WiFi/BT
  • Freescale MK20 – ARM Cortex M4, as the Teensy 3.2 Feather Adapter
  • Nordic nRF51 and nRF52 – ARM Cortex & Bluetooth LE
  • Packet radio modules featuring SemTech SX1231
  • LoRa radio modules featuring SemTech SX127x

and many more to come!

Wings!

Once you’ve picked your main dish (the Feather mainboard) you can pick and choose from a wide wide variety of Wings. Wings are like little “shields” or “HATs” for Feathers. You can (in theory) add as many Wings as you like to a single Feather main-board, as long as you don’t run out of power, space or have pin collisions.

Best of all, we’ve tested all of our Wings against all of our Feathers. So, other than a few exceptions (mostly the GPS Featherwing), you can re-use, re-cycle, and upgrade your Feathers and Wings between projects and as need arises.

For example, start out with a Feather 32u4, then decide to upgrade to the Feather M0 for more Flash – the pin out is the same! Or, make an IoT project with the ESP8266 and then super-power it with an ESP32 just by swapping out the main Feather. Maybe build a project with a Feather M0 Bluefruit, then realize you need more range so you switch to a Feather M0 LoRa.

The Feathers and Wings all have example code written in Arduino C/C++ so as your projects adapt, all your wings and code will come along with you.

TOOLS40 LIBRARY, USEFUL TOOL USING OUR EQUIPMENTS

Tools40 library?include?SimpleComm library, Filter library and Timer library.

With the?SimpleComm library?you can send data through any Arduino Stream: RS-485, RS-232, and Ethernet? It is enough flexible to support different kind of communication typologies: Ad-hoc, Master-Slave, Client-Server? Using an easy to use API.

Filter library includes filtering software that allow you to smooth analog inputs. This is really useful when you have an analog signal that is unstable.

With?Timer library?you can create 3 different timers like Ladder standard Timers:

  • PulseTimer : when there is a rising edge on input value, PulseTimer active Output during the selected time.
  • OnDelayTimer: when Input is active (HIGH) during the defined time, the related Output will be active. Output will be disabled when Input is inactive.
  • OffDelayTimer: As the same of OnDelayTimer, but?when Input is inactive (LOW) during the defined time, the related Output will be active. Output?will be disabled when Input is active.

Next it is explained?how to use?Filter library and the Timer library:

First you have to define the Timer or the Filter and give it a name. After that, you just have to create a variable and related with the wanted Input. On Timers the last step is to use this variable to selected Output. Next it is showed an example of how to use it.

HOW TO USE STEPPER MOTOR WITH ARDBOX ANALOG

This post is showed how to control a steeper motor with an Ardbox analog.

Example requirements:

Important: our equipment?s are prepared for work with common ground !!!

 

Once we have all the requirements we proceed to connect?Ardbox, Driver and Stepper motor.

Usually the Stepper Drivers has at least 3 Inputs (Enable, Direction y Pulses). On our Ardbox we will connect the GND and the 5V from the SPI side between the GNDCom and 24Vcom from the Output side (Q?s). With that we will fix outputs at 5V. We will connect GNDCom with GND of the Stepper Driver. And we will use two outputs to control Enable and Direction. In this example we have used Q0_0 for Direction and Q0_1 for Enable. At last we will connect PIN 3 to PULL (Pulses).

Important: to generate a PWM enough fast to control a stepper motor we must use PIN 3 (Ardbox) and PIN 3 and PIN2 (M-Duino). The normal digital outputs of our equipment?s (Q?s) are limited over 500Hz!!!

Once inputs driver are connected we proceed to connect the stepper motor. Each phase has to be connected with its respective driver output. And connect power supply of the Driver. In our example it is used a stepper motor of 12V and 1,8? angle for each phase.

Next is showed an example code controlling the stepper motor for turn on the same side

MY OPEN-SOURCE, DO-IT-YOURSELF CELLPHONE

For a little over a year, I?ve been working on an open-source, DIY cellphone as part of my PhD research at the MIT Media Lab. The current version of the phone is based on the Arduino GSM shield and Arduino GSM library. It sports a deliberately low-resolution screen (8 characters, each a 5?7 matrix of LEDs), a laser-cut wooden enclosure, flexure (living hinge) buttons, and a ~1000-line Arduino program that powers the user interface. The phone can make and receive phone calls and text messages, includes a phone book and caller id, and keeps the time. Everything you?d expect from a 20-year old Nokia! (Except snake.) I?ve been using various iterations of the project as my primary cellphone for the past six months or so.

 

The phone is open-source and the design files are available on GitHub (hardware, software). Assembly instructions are on my website, although I wouldn?t recommend making your own unless you have experience with soldering surface mount components.

 

Of course, it?s not just me that?s been building these phones. I?ve run twoworkshops in which other people have made them for themselves. A few people have been building them on their own, including someone who posted his result on Twitter.

 

Here you can see some the variations on the enclosure that my friends have made. On the left is a 3d-printed case by Ben Peters, the middle is a CNC-milled purpleheart wood case by Dena Molnar, and on the right is a hand-cut cardboard case by Jeffrey Warren.

 

The phone has undergone numerous revisions as I?ve tried to get it into a robust, useable form. Here you can see some of those variations. I started with an LCD screen like those found on old Nokia phones, but it would break after a month or so in my pocket, so I switched to the more-robust LED matrix. The enclosure has had a few tweaks as well, primarily to find a good design for the flexure buttons.

 

Overall, I?m pretty happy with the current incarnation. It seems to be relatively robust, simple enough to assemble by hand, and functional enough to use everyday (although a long way from a smart phone). That?s my DIY cellphone.

LOG YOUR HAMSTER?S RUNS WITH ARDUINO

We?ve all seen hamsters in a cage, furiously running nowhere. Perhaps you?ve thought about the pointlessness of this activity, before going to the gym to lift weights up and down or run on a treadmill. From an outside perspective, both activities seem pointless, but when you realize the benefits, maybe?tracking what ?feats of strength? you?re able to accomplish, things become much more clear.

As seen on Hackaday, in order to track the activity of his daughter?s hamster, John Mueller implemented an Arduino Uno-based system that records revolutions using a magnet and a reed switch. Every time the magnet on the wheel passes the fixed switch, it triggers an Arduino input, recording how many revolutions, and thus how many miles the little guy runs each night. Results are quite impressive considering its size, recording over 3.5 miles on one occasion!

This type of encoder concept could be used in many different situations, such as logging bicycle speeds, or tracking motor stats.

Ladyada’s Learn Arduino – Lesson #0

If you’re here, it’s because you want to learn how to build and make stuff with electronics! (If, rather than learn electronics, you’d like to look at pictures of cats instead, please check https://www.adafruit.com/galleries/cats-of-engineering)

And, you’re in luck: there’s never been a better time.

Gone are the days where you need thousands of dollars of equipment and lots physics/math background. Nowadays, if you want to learn to work with electronics, you can jump right in for $100 or less, and any sort of computer. And we’re talking about learning a lot of electronics – from the basics of analog to the complexities of firmware. With a good pack of parts, you can build a base of knowledge that will take you from your first blinking LED to someone who can start prototyping and inventing custom products.

Who is this for?

Anyone with a computer they can install software on, an Arduino or compatible and the ability to type and click a mouse. That’s pretty much the minimum.

You don’t need to know a lot of physics or math, and just like an Art Degree isn’t required for making art and being creative, you don’t need to have a computer science degree. It helps if you’re comfortable using computers but that’s a skill most people pick up through life.

If you know how to program already – great! If not, don’t worry, we’ll teach you enough to be dangerous.

Who are you?

Great question. This is me:

I’m Ladyada, and I love to teach people how to build stuff and how they can be creative with technology.

So, are you ready?

Let’s do this thing!

What is an Arduino?

Arduino is the name of the little electronic circuit board that you are going to use as a tool to investigate and explore programming & electronics.

It is manufactured by arduino.cc a company?led by Massimo Banzi, CEO of Arduino. Here is how they describe themselves:

Arduino is an open-source prototyping platform based on easy-to-use hardware and software. Arduino boards are able to read inputs – light on a sensor, a finger on a button, or a Twitter message – and turn it into an output – activating a motor, turning on an LED, publishing something online. You can tell your board what to do by sending a set of instructions to the microcontroller on the board. To do so you use the Arduino programming language (based on Wiring), and the Arduino Software (IDE), based on Processing.

Over the years Arduino has been the brain of thousands of projects, from everyday objects to complex scientific instruments. A worldwide community of makers – students, hobbyists, artists, programmers, and professionals – has gathered around this open-source platform, their contributions have added up to an incredible amount of accessible knowledge that can be of great help to novices and experts alike.

Here’s a photo of Massimo and I at the Adafruit factory, showing off the first Arduino UNO made in the USA!

About This Lesson

This lesson won’t teach any electronics, really. Its more for making sure that everything is setup and ready for the future lessons. It will verify the board is working as intended and that the computer you are using is compatible.

Think of this tutorial as the ‘home base’ of your journey. If things ever get into a weird spot come back here and re-verify this lesson!

One of the most important skills you’ll have to learn is that when things go wrong (and they will, tons) come back to the most basic assumptions. This is a little bit of the “are you sure its on” of electronics. It’s surprising how many skilled engineers will spend hours debugging a circuit to realize that…it wasn’t plugged in!

Which Arduino?

In the ten years since Arduino was first released, there’s been a huge proliferation of hundreds of different “Arduino boards” available. On one hand, there’s an Arduino for just about every kind of specialized purpose, but on the other hand – it can get quite confusing!

In this tutorial we’ll be focusing on the Arduino UNO which is the classic Arduino, by far the most popular and is what 99% of projects use. It’s basic, well supported, and is a great starter-duino.

Debugging the SAMD21 with GDB

The SAMD21 is a microcontroller developed by Atmel which runs at 48mhz with a Cortex M0+ core. It’s used in the Arduino Zero, Arduino M0 Pro and Feather M0s. Many of our Arduino and MicroPython libraries use C to interface directly with the hardware and when things go wrong it can be hard to figure out why.

Unlike more common web or server software development the code isn’t being run on the same machine as its written on. When code is compiled for a different architecture, such as ARM for the SAMD21, than the architecture the compiler is running on, usually x86, its called cross compiling. There are many different ways to organize how your code compiles we can cover in another guide. What you need to know is that there are a few different toolchains that convert human readable code to machine code. Today we’ll focus on the GNU toolchain that is made up of the GNU Compiler Collection (better known as gcc), the GNU Debugger (gdb) and number of other programs. Since the GNU toolchain is open source, ARM, the designer of the Cortex M0+ core, is able to ensure it produces well working code for their cores. So, we’ll be using the ARM version of the GNU toolchain to compile and debug the C code.

While I won’t cover compiling the code, I’ll be using the Adafruit version of MicroPython in the examples. Its source is here and it uses make to run the compiler. I also use an Arduino Zero for all of my debugging because it has a builtin debug chip which converts USB commands to commands the Cortex M0+ core understands.

There are a couple aspects of debugging we’ll talk about. First we’ll cover a few ways to stop the program at an interesting spot. Second, we’ll cover how to inspect the current program state using backtrace. Lastly, using the Micro Trace Buffer, we’ll inspect the history of the program execution. Lets get setup.

Software Installation

There are two pieces of software we need to install in order to get debugging. OpenOCD is a tool to communicate with debug hardware tools such as the EDBG chip on the Arduino Zero or a JLink. GDB is the GNU Debugger which talks with OpenOCD to control and inspect the raw state of the microcontroller and, using the binary symbols, translate that info back into the source code realm.

OpenOCD

You can get OpenOCD from here. Below are quick start instructions.

Windows

Download and install the latest binary from here.

Mac OSX

Installation on Mac OSX is easiest using Homebrew. (If you don’t have brew installed see here.)

brew install open-ocd

Linux

Its best to use your package manager to install openocd. Exactly how you do that will vary with your distribution. Here are some examples.

# Ubuntu, Debian, Raspbian, Mint
sudo apt-get install openocd # http://packages.ubuntu.com/search?keywords=openocd&searchon=names
# Fedora
su -c 'yum install openocd' # https://apps.fedoraproject.org/packages/openocd
# Arch
pacman -S openocd # https://www.archlinux.org/packages/community/x86_64/openocd/

GDB

GDB is part of the larger ARM toolchain. So don’t be surprised to see a number of arm-none-eabi-* binaries installed.

Windows

Download install the win32 executable from here.

Also make sure that you have 32-bit (x86 not x86-64) Python 2.7x installed from here. We’ll be using Python to interpret the Micro Trace Buffer later.

Mac OSX

Installation on Mac OSX is easiest using Homebrew. (If you don’t have brew installed see here.)

brew install arm-none-eabi-gcc

Linux

Its best to use your package manager to install the arm gcc toolchain. Exactly how you do that will vary with your distribution. Here are some examples.

# Ubuntu, Debian, Raspbian, Mint
sudo apt-get install gdb-arm-none-eabi
# Fedora
su -c 'yum install arm-none-eabi-gdb' # https://apps.fedoraproject.org/packages/arm-none-eabi-gdb
# Arch
pacman -S arm-none-eabi-gdb # https://www.archlinux.org/packages/community/i686/arm-none-eabi-gdb/

Setup

This setup is for the Arduino Zero because it has an easy, on-board debug chip. Debugging other boards including Feathers through J-Link is a slightly different process not covered here.

Before we can get into the nitty gritty of debugging we need to first get everything running.

OpenOCD

First, we need to get OpenOCD going to bridge from our computer to the hardware debugger. Its easy with the Arduino Zero.

Arduino Zero

Connect a USB cable from your computer to the DEBUG USB connector on the Arduino Zero. Now, make sure you have the Arduino Zero config file for OpenOCD available here.

Now run OpenOCD in a terminal. It will stay running while we debug.

openocd -f arduino_zero.cfg

You should see that it found the Arduino Zero with output similar to this:

Info : CMSIS-DAP: SWD  Supported
Info : CMSIS-DAP: Interface Initialised (SWD)
Info : CMSIS-DAP: FW Version = 02.01.0157
Info : SWCLK/TCK = 1 SWDIO/TMS = 1 TDI = 1 TDO = 1 nTRST = 0 nRESET = 1
Info : CMSIS-DAP: Interface ready
Info : clock speed 500 kHz
Info : SWD IDCODE 0x0bc11477
Info : at91samd21g18.cpu: hardware has 4 breakpoints, 2 watchpoints

GDB

GDB is similarly straightforward. The most important thing is that your current directory is near your binary. With Adafruit’s MicroPython I like to be in the atmel-samd directory where our binary is build-arduino_zero/firmware.elf. (If you are following along with MicroPython you can compile it with make BOARD=arduino_zero DEBUG=1.)

arm-none-eabi-gdb-py build-arduino_zero/firmware.elf

Now you should see some version information and a prompt that start with (gdb). All examples that start with (gdb) should be run in gdb and you do not need to type (gdb) in.

Now we need to tell GDB to debug through OpenOCD rather than on this computer.

(gdb) target extended-remote :3333

Loading, Resetting and Running

Loading, resetting and running the currently running program on the microcontroller is critical to the debugging process. To load a new version of the program after you’ve compiled outside of gdb do:

(gdb) load
Loading section .text, size 0x2bb84 lma 0x0
Loading section .data, size 0x5a4 lma 0x2bb84
Start address 0x0, load size 180520
Transfer rate: 5 KB/sec, 13886 bytes/write.

To reset the microcontroller to the start of the new program you need to ask OpenOCD via monitor to reset to the initialization state.

(gdb) monitor reset init
target state: halted
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x00018dd0 msp: 0x20008000

Finally, to make the program run type continue or c and hit enter. The prompt won’t return until your program finishes, hits a breakpoint or you type ctrl-c.

Breakpoints

Its great if your program runs as expected but what if it doesn’t? It may crash or return an error when you least expect. Breakpoints are a great way to stop the execution of your code so you can inspect how you got a certain place in your code and with what state. There are two primary ways I use breakpoints:

  1. to stop when a function is called.
  2. to stop at a particular line of code.

Once stopped, we can use backtrace and the Micro Trace Buffer to see our current state and how we got there.