Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

How to make a REST API for Arduino & the CC3000 WiFi Chip #ArduinoD14

Marco Schwartz created this tutorial on how to make a REST API for his Arduino Yun and the CC3000 WiFi chip, from openhomeautomation.

I was recently playing with the Arduino Yun for a whole set of new projects, and I discovered a sketch that implements a REST API for the Arduino Yun. We’ll see in more details what a REST API is, but for now let’s say it allows to standardise the communication between your Arduino and the external world via WiFi or Ethernet, and develop complex applications without having to modify your Arduino sketch every time.

So I told myself: why not create one REST API for the CC3000 WiFi chip ? That’s exactly what I did as a weekend project, and I wanted to share it with you. If you want to directly jump to the project files, go over to the GitHub repository of the project.

So what’s a REST API ?

You may wonder: what’s a REST API ? It’s actually a concept that is widely used by many web applications like SaaS. REST stands for Representational State Transfer, and is a communication architecture that was created back in 2000. It defines many constraints that the architecture has to follow, the most important features being:

  • A client/server communication: a client sends a request to a server, and the server answers accordingly
  • A stateless communication: every request has to contain all the information so the server can understand it, without having to rely on some information stored on the server
  • A uniform interface to easily identify resources on the server

This allowed to standardise communication between web applications, and made them more scalable, faster, and simplified the development of more complex applications. Many applications now propose a REST API, for example the eCommerce plugin I am using on this website.

Why do we need it for Arduino & the CC3000 WiFi chip ?

The problem that I encountered while developing web applications using the CC3000 is that I had to create a new Arduino sketch for every application, that needs to be coordinated with the rest of the application, for example an interface running on my computer.

And then, I discovered the REST API of the Arduino Yun. It is a simple sketch for the Arduino Yun that allows to make REST calls directly from your browser. For example:

http://arduinoyun.local/arduino/digital/8/1
will put the pin number 8 to a high state on my Arduino Yun. With this REST interface, it’s easy to load a sketch once for all on your Arduino, and then only work on the interface on your computer that makes REST calls on your Arduino board. And for now, this kind of interface was only available on the official Arduino boards, like the WiFi & Ethernet shields, and the Yun.

But I wanted to have the same on my CC3000 WiFi chip: make a sketch that will create a web server on the Arduino board, and then accept REST commands from an external client, like from an interface running on my computer. With this, I just have to build complex web applications on my computer, and then made them interact with the REST API of my Arduino board. And that’s what I built in this project.

IMG 7938 small

Read more.


Featured Adafruit Products!


1498 MED

Arduino YUN (YÚN ): Arduino Yún is the first member of a new groundbreaking line of wifi products combining the power Linux with ease of use of Arduino. Yún means “cloud” in Chinese language as the purpose of this board is to make it simple to connect to complex web services directly from Arduino. The first Arduino Yún is the combination of a classic Arduino Leonardo (based on the Atmega32U4 processor) with a Wifi system-on-a-chip running Linino (a MIPS GNU/Linux based on OpenWRT). Read more!


1469 MED

Adafruit CC3000 WiFi Breakout with Onboard Ceramic Antenna – v1.1: The CC3000 hits that sweet spot of usability, price and capability. It uses SPI for communication (not UART!) so you can push data as fast as you want or as slow as you want. It has a proper interrupt system with IRQ pin so you can have asynchronous connections. It supports 802.11b/g, open/WEP/WPA/WPA2 security, TKIP & AES. A built in TCP/IP stack with a “BSD socket” interface. TCP and UDP in both client and server mode, up to 4 concurrent sockets. It does not support “AP” mode, it can connect to an access point but it cannot be an access point. Read more!




Adafruit has had paid day off for voting for our team for years, if you need help getting that going for your organization, let us know – we can share how and why we did this as well as the good results. Here are some resources for voting by mail, voting in person, and some NY resources for our NY based teams as well. If there are additional resources to add, please let us know – adafruit.com/vote

Stop breadboarding and soldering – start making immediately! Adafruit’s Circuit Playground is jam-packed with LEDs, sensors, buttons, alligator clip pads and more. Build projects with Circuit Playground in a few minutes with the drag-and-drop MakeCode programming site, learn computer science using the CS Discoveries class on code.org, jump into CircuitPython to learn Python and hardware together, TinyGO, or even use the Arduino IDE. Circuit Playground Express is the newest and best Circuit Playground board, with support for CircuitPython, MakeCode, and Arduino. It has a powerful processor, 10 NeoPixels, mini speaker, InfraRed receive and transmit, two buttons, a switch, 14 alligator clip pads, and lots of sensors: capacitive touch, IR proximity, temperature, light, motion and sound. A whole wide world of electronics and coding is waiting for you, and it fits in the palm of your hand.

Join 24,000+ makers on Adafruit’s Discord channels and be part of the community! http://adafru.it/discord

Have an amazing project to share? The Electronics Show and Tell is every Wednesday at 7pm ET! To join, head over to YouTube and check out the show’s live chat – we’ll post the link there.

Join us every Wednesday night at 8pm ET for Ask an Engineer!

Follow Adafruit on Instagram for top secret new products, behinds the scenes and more https://www.instagram.com/adafruit/

CircuitPython – The easiest way to program microcontrollers – CircuitPython.org


Maker Business — To make it through a tough business cycle, layoffs should be a last resort

Wearables — Rub’n’buff

Electronics — Multimeter Bandwidth – AC Signal

Python for Microcontrollers — Python on Microcontrollers Newsletter: CircuitPython 6 Release Candidate, new hardware & more! #Python #Adafruit #CircuitPython #ElectronicHalloween @micropython @ThePSF

Adafruit IoT Monthly — Matrix Portal, Solar Lawn Sprinkler and more!

Microsoft MakeCode — micro:bit version 2 Announced!

EYE on NPI — Maxim’s Himalaya uSLIC Step-Down Power Module #EyeOnNPI @maximintegrated @digikey

New Products – Adafruit Industries – Makers, hackers, artists, designers and engineers! — New Products 10/21/2020 Featuring #Adafruit Voice Bonnet for Raspberry Pi – Two Speakers + Two Mics! @adafruit #newproducts

Get the only spam-free daily newsletter about wearables, running a "maker business", electronic tips and more! Subscribe at AdafruitDaily.com !



No Comments

No comments yet.

Sorry, the comment form is closed at this time.