DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
View Events Video Library
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Integrating PostgreSQL Databases with ANF: Join this workshop to learn how to create a PostgreSQL server using Instaclustr’s managed service

Mobile Database Essentials: Assess data needs, storage requirements, and more when leveraging databases for cloud and edge applications.

Monitoring and Observability for LLMs: Datadog and Google Cloud discuss how to achieve optimal AI model performance.

Automated Testing: The latest on architecture, TDD, and the benefits of AI and low-code tools.

Related

  • How to Stream Sensor Data to Apache Pinot for Real Time Analysis
  • How To Check Tuya Library in Arduino IDE
  • The Internet of Dogs: How to Build a $50 IoT Dog Collar That Locates Your Pet
  • Setting Up Your Own Arduino IoT Cloud Server

Trending

  • How To Verify Database Connection From a Spring Boot Application
  • Parallelism in ConcurrentHashMap
  • Memory Management in Java: An Introduction
  • Best Plugins For JetBrains IDEs
  1. DZone
  2. Data Engineering
  3. IoT
  4. How to Add WiFi to Your Arduino

How to Add WiFi to Your Arduino

A step-by-step guide to installing the Adafruit CC3000 to add WiFi capabilities to your Arduino Mega device

Jeremy Morgan user avatar by
Jeremy Morgan
·
Dec. 28, 15 · Tutorial
Like (6)
Save
Tweet
Share
8.12K Views

Join the DZone community and get the full member experience.

Join For Free

If you want to add internet connectivity to an Arduino, you have quite a few options. Since most Arduino models are not bundled with Ethernet or WiFi a market has developed for it, and I decided to try one out and share my thoughts.

For this article I’ll be using the Adafruit CC3000 breakout board found here. For the platform I’m using an Arduino Mega 2560 I received from Newark element14.

Assembling the CC3000

The CC3000 comes shipped with the board and pins like so:

Arduino WiFi How To

This kit does require soldering, but not a lot. One tip is to break off the 9 pins as instructed and put them in the a breadboard and place the PCB on top:

Arduino WiFi How To

This will hold it in place while soldering, when done it should look like this:

Arduino WiFi How To

Only I hope your soldering looks better.

Now, put it on the breadboard and wire it up! The wiring instructions are here and in this case it’s wired up for an Arduino Mega.

Arduino WiFi How To

Notice I have an additional power supply coming in. A note from Adafruit:

Make sure your Arduino is powered by a 1 amp or higher rated external power supply when using with the CC3000! Powering an Arduino + CC3000 from a computer/laptop USB port will lead to unstable behavior and lockups because the USB port can’t supply enough power!

This is good advice, and if you don’t have a power supply yet, pick one up. You’ll need it when you start adding things to your Arduino.

Software

Now, we’re going to work on the software part of the project using Arduino Sketch. I’m doing it in Linux, but the instructions will be the same for Windows and OSX as well.

You’ll want to make sure and get the latest Adafruit CC3000 library here for the next steps.

Unzip this file into a folder, we’ll be working with some of the demos included. Do not delete the Zip file.

Open up sketch and browse to the folder you just created:

Arduino WiFi How To

Run the Build Test

We want to run the build test to make sure the device is working correctly. Open up buildtest.ino. You’ll need to change the following to connect to your WiFi network:

#define WLAN_SSID       "myNetwork" 
#define WLAN_PASS       "myPassword"

Note if you want to change the security setting for your WAP with the “WLAN_SECURITY” Variable.

Save the sketch. Now you’ll want to import the Adafruit CC3000 library into your sketch. This is generally the fastest way to do it:

Arduino WiFi How To

Browse to where you downloaded the zip archive and import it.

Now, try compiling the sketch. You should see this:

Arduino WiFi How To

It is now ready to send to the Arduino. Next I’ll show you how to communicate with the Arduino to watch what’s happening.

Monitor the Serial Port

You can compile a sketch and push it to the Arduino and (hopefully) things will happen. The serial monitor is a good way to visually see what’s happening and get feedback from the device. In the Sketch IDE go to Tools -> Serial Monitor.

Arduino WiFi How To

Note: If you’re using Linux, you may need to add your user account to a group to access this port. Instructions can be found here for how to do that.

Make sure and set the proper baud rate for the CC3000, which is 115200:

Arduino WiFi How To

If your WiFi info is correct, you should see:

Arduino WiFi How To

And after it connects it will attempt to ping adafruit. If successful it will look like this:

Arduino WiFi How To

I’m not sure why but on mine it says it failed to get an IP, then displays it and pings the site. I’ll be looking into that further soon. If all tests pass you’re ready to go.

Build a Web Server

For this project, go back into the examples folder and go into the HTTPServer folder.

Arduino WiFi How To

Open up HTTPServer.ino in sketch. Like the previous file, you will need to change the WiFi settings:

#define WLAN_SSID       "myNetwork" 
#define WLAN_PASS       "myPassword"

Note if you want to change the security setting for your WAP with the “WLAN_SECURITY” Variable.

Verify and upload the sketch.

Open the Serial Monitor again to watch the output of the sketch. If successful, you should see something like this:

Arduino WiFi How To

Your server is now listening and ready to go!

Open a web browser and browse to the IP address:

Arduino WiFi How To

And easy as that you have a web server up. It’s pretty barebones but a good starting point.

Conclusion

I’ve been doing a considerable amount of hacking on the Arduino and the lack of network connectivity hasn’t been that big of a deal. However I know for future projects it will be necessary which is why I decided to purchase this kit and give it a try, and share my results with you.

Overall it was really easy to assemble, only having to solder the pins in. The wiring diagrams are clearly laid out on the Adafruit site, and the software is pretty much written for you. At $34.95 this is an awesome deal for hobbyists wanting an easy way to go Wifi. I opted for the breakout option to see how well it works in case I want to build a product that uses this form factor. I would be curious to see how the shield version stacks up, but I suspect it will be identical.

If you’re looking for a quick, easy way to add WiFi to your Arduino, I recommend the CC3000.

Thanks again to Newark element14 for the Arduino Mega!

arduino

Published at DZone with permission of Jeremy Morgan, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • How to Stream Sensor Data to Apache Pinot for Real Time Analysis
  • How To Check Tuya Library in Arduino IDE
  • The Internet of Dogs: How to Build a $50 IoT Dog Collar That Locates Your Pet
  • Setting Up Your Own Arduino IoT Cloud Server

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends: