Chapter 8. On the Wi-fly

In this chapter, we will have a look at yet another new Arduino compatible board called the Particle Core. The big feature with this board is that it includes Wi-Fi connectivity in a very small form factor. I guess most of you are familiar with Wi-Fi technology these days as Wi-Fi has become a standard for wireless communication in almost all personal computers and smart phones, and in recent years we can even find Wi-Fi technology in many consumer electronics. One of the first consumer products including Wi-Fi technology which was not a personal computer was weirdly a bathroom scale. Today, we find stereos, robot vacuum cleaners, light bulbs, and even refrigerators that include Wi-Fi technology. The reason for this is of course to connect these products to the Internet.

Even though I am not that old, I still remember a time when anything connected to the Internet needed a cable, but fortunately those days are long gone. Wi-Fi technology is still older than one might think. The development started in the early 70s, but it was not until the late 90s that Wi-Fi started to become commercially available and used. Even in the beginning of the age of Wi-Fi for personal computers, Internet connections over cable were preferred since the speed over Wi-Fi nowhere near matched the speed over cable connections. Wi-Fi has still not caught up with cable connections, but it is still fast enough for our everyday needs.

Wi-Fi is a local area wireless computer networking technology, which can be used for peer-to-peer connections, or connecting to the Internet through a router. The actual name of the technology is IEEE 802.11x where x is a letter that indicates the version of the technology. The term Wi-Fi was not used until the late 90s when the name was rebranded for commercial purposes. The reason was simple: it is easier to say Wi-Fi than to refer to the technology as IEEE 802.11. In recent years, Wi-Fi has become faster, smaller, and cheaper, which has made it one of the backbone technologies of the "Internet of Things".

By now, you are familiar with wearables and some consider wearables as a sub-domain in the Internet of Things where ordinary objects are modified with computational abilities and connected to the Internet. Personally, I like to think that wearables will become the "glue" devices that connect all of these things to the Internet.

So, of course we will have a look at Wi-Fi technology in this book since I find it fitting to end the book with what will become the future (hopefully the future will prove me right). The remaining two chapters will focus on the Particle Core, where we will first introduce the board and how to wirelessly program it then, in the last chapter, use the Particle Core to make our own smart watch.

In this chapter, we will have a look at how to connect to the Core board and how to code for it. We will also have a look at how to send information to and from the Internet and how to control the board from a simple web page. We will also have a look at how to connect the Core to third-party services through the use of a mash-up service called IFTTT.

The following are the materials that you will need for this chapter:

  • Particle Core
  • Micro USB (included in the development kit)
  • Mini breadboard (included in the development kit)
  • LEDs
  • A 220Ω resistor
  • An Android or iPhone phone

The Particle Core

The Particle Core is an Arduino-compatible board but with some reservations. In fact, the Particle Core is based on ARM Cortex-M3 processors, which use a different architecture from the Atmega microprocessors used in most Arduino-compatible boards. This means that the Particle Core can't be programmed from the Arduino IDE at the moment, but don't worry as there are other options.

Still we can consider the Particle Core to be Arduino-familiar since we can program them using the same commands and structure as used to program all Arduino boards. Many of the libraries available for Arduino boards also work for the Particle Core and some are specifically developed for the Particle Core in order to utilize the Wi-Fi connectivity. Figure 8.1 shows the development kit available from:

https://www.particle.io/.

This kit includes the Particle Core board, a mini breadboard, and a micro USB cable:

The Particle Core

Figure 8.1: The Particle Core starter kit

In order to get started on programming the Particle Core, we need to connect it to your network. To do so, we will need some help from the Particle app in order to connect your Particle Core to your network. The app is available for both Android at https://play.google.com/store/apps/details?id=io.particle.android.app and for IOS at: https://itunes.apple.com/us/app/particle-build-photon-electron/id991459054?ls=1&mt=8.

To set up your Particle Core, perform the following steps:

  1. Download and install the app on your smartphone.
  2. Once installed, you need to create a new account or sign in with an existing one.
  3. Power the Particle Core using the included Micro USB cable.
  4. Connect the phone to the Wi-Fi network you want to use and then enter the password for the network in the app.

The app should automatically find your Particle Core board and connect it to the network. In order to debug the different modes of the Particle Core, the board includes an RGB LED on the top in order to indicate the different states:

  • The blue light blinking means that the board is looking for Wi-Fi credentials
  • The blue light full on means that the board is getting information from the app
  • Green blinking means that the board is connecting to a Wi-Fi network
  • Cyan blinking means that the board is connecting to the Particle cloud
  • Magenta blinking means that the board is updating its firmware to the newest version
  • Pulsating magenta means that the board is connected and ready to use

If the app should fail to connect and the LED just keeps blinking blue, try to connect one more time from the app. If the board gets stuck on green blinking, try holding down the small Mode button on top of the board for a few seconds until the light starts blinking blue again. The Mode button is located to the left of the RGB LED There is a button to the right of the LED also marked RST, which means RESET, and as suggested by its name, this button resets the program on the board.

Hopefully everything went smoothly and if so, the Tinker screen should appear in the app as shown in Figure 8.2. The Tinker screen enables basic read and write operations on the pins on the Particle Core board from the phone app:

The Particle Core

Figure 8.2 The Tinker screen in the core app

In order to test that everything works:

  • Try tapping on the D7 pin in the application and set it to digital write
  • Press on it again and set the mode to High. This should turn on a small blue LED at the top of the Particle Core next to the USB connector
  • If the blue LED turns on, everything works and the Particle Core board is connected to your Wi-Fi network
  • If not, run the connection process again and make sure you connect to the right network from the application

Once connected to the Particle Core, you also have the option to change the name of your board, which might be a good idea if you have multiple boards. If not, you can leave the name as is.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.84.32