Have you ever been in a situation where you have no access to a sports website, but you have access to the results of your college's football game? Me neither. But if you ever are, this project is a great way of keeping track of your college's football season record through the use of Particle Argons and Amazon Alexa.
The premise of the project is simple, a user would tell their Echo Dot what the outcome of the game was, and then through the use of Particle and IFTTT, that result is displayed on both an LCD screen and a corresponding LED light. As time goes on, the results are also tracked in a Google Sheet so that the team record for the season could be seen at any time.Hardware
- SunFounder IIC I2C TWI 1602 Serial LCD Module Display for Arduino R3 Mega 2560 16x2. This I2C LCD is extremely easy to use and can be hooked directly into the Particle Argon with only four cables out of the box. It can also easily be controlled by the Liquid Crystal Library which will be shown later.
- Amazon Echo Dot. The echo dot and other Amazon Alexa products are becoming increasingly more popular in households around the world so it makes for a very simple addition to the project and ties easily to IFTTT.
- Chanzon 3mm LED. Simple and cheap, all you need.
- Particle Argon. The bread and butter behind the entire project. The Argon is a powerful Wi-Fi-enabled development board for Wi-Fi networks. It is based on the Nordic nRF52840 and has built-in battery charging circuitry so it’s easy to connect a Li-Po and deploy your local network in minutes.
The Argon is great for connecting existing projects to the Particle Device Cloud over a Wi-Fi network.Software
- Particle IDE
- Google Sheets
Below is a flowchart representation of the project generated in Microsoft Excel. For ease of viewing, the different components of the project have different colors:
As shown above, the two particles rely on communicating with each other in order to perform all of the necessary actions. How they specifically do this is explained later.IFTTT Integration
This project relies heavily on a program called 'If this Then That' which allows the user, once they have created a free account, to create workflows that can tie in all sorts of programs and functions. Since we want to use Alexa as the driver of the project, we have to set up the IFTTT responses to certain trigger phrases.
First, we set up a response for the way more likely outcome of a Charlotte win. We do this by using the Alexa 'If' and the Particle Publish 'Then' recipes, these can be seen below:
Next, we have to set up the way less likely outcome where Charlotte loses a game. For this, we follow the same setup shown in the overview, but with new values in the 'If' and 'Then' recipes. This is shown below:
Now that the Alexa recipes have been built, we can go ahead and build the Google Sheet recipes that will track the record of the team. For this, we will use the Particle recipe to sense when the event has been published and then use the GoogleSheet recipe to add a line to a sheet with the event name and time of the win or loss. This can be seen below for the scenario of Charlotte Winning:
Next, we can construct the same program but for the scenario of Charlotte losing a game. This uses the same structure as the overview and is shown below:
Now that all of the IFTTT recipes have been built, we can move on to the physical components of the project. It is important to note that for the Google Sheet recipe, IFTTT only polls to see if a function was published ~once per hour~, so if you want immediate results you should use the 'Check Now' button.Wiring
After the IFTTT recipes have been assembled we can now construct the physical circuits. Starting with the LCD setup, this was the most challenging due to the limited examples on the internet but turned out to be surprisingly simple:
- Connect the Particle GND pin to the grounded row on the breadboard. Attach the GND pin of the LCD to the grounded row.
- Connect the Particle 3V3 pin to the positive row on the breadboard. Run a jumper wire from the bottom positive row to the top positive row. Attach the LCD VCC pin to the Particl VUSB pin (We do this because the LCD requires at least a 5V input).
- Connect the LCD SDA pin to the Particle SDA pin. Run a 2.2k ohm pull-up resistor from the SDA pin on the Particle to the positive row on the breadboard. The Particle Docs show that any resistance from 1.5k to 10k ohm will work, I used a 2.2k ohm with no issues.
Connect the LCD SCL pin to the Particle SCL pin. Run a 2.2k ohm pull-up resistor from the SCL pin on the Particle to the positive row of the breadboard.
The finished product is shown below:
Next, we construct the second circuit by building a very simple 'Blink the LED setup'. For this we just followed the example shown in the Particle Docs:
- Connect the Particle GND pin to the grounded row on the breadboard.
- Connect a 220 ohm resistor from the breadboard's grounded row to the breadboard positive row.
- Connect the short leg of a Green LED to the breadboard's positive row and the long leg to Particle's D7 pin.
- Connect the short leg of a RED LED to the breadboard's positive row and the long leg to Particle's D5 pin.
Now that both physical circuits have been wired, we can construct the code for the project.Libraries
- LiquidCrystal_I2C_Spark - This library was used to control the text displayed on the LCD. Liquid Crystal was primarily an Arduino library but was built over in Particle as well, so using it can be a little tricky. Checking out this GitHub page will help explain how it works.
- Application - This library was just used so that the string function would work properly.
To graph the live results of the project we used the IFTTT trigger shown above to publish the results to a Google Sheet. The resulting Google Sheet is shown below:
- The 'A' column shows the function that was published
- The 'B' column shows the date and time the function was published
- The D3 cell shows the totaled wins
- The E3 cell shows the totaled losses
- The column graph visually displays the information
The equation used to calculate the wins and losses for the D3 and E3 cells is shown below:
After everything is said and done, the project runs smoothly and efficiently. A video demonstration is below: