Project in progress
SciJoy Data Logger

SciJoy Data Logger

The universal Amazon Alexa datalogging and control device.

  • 783 views
  • 0 comments
  • 8 respects

Components and supplies

Ard yun
Arduino Yun
×1
Pi 3 02
Raspberry Pi 3 Model B
Connect the Arduino by USB.
×1
Solenoid
×1
DC motor (generic)
×1
Relay (generic)
×2
Tens70
9V battery (generic)
×1
Echo
Amazon Alexa Amazon Echo
×1

Apps and online services

About this project

I have wanted to create a platform that simplifies datalogging since I began coding. This project provides an Arduino-compatible system that is driven by Amazon AWS and controlled through user input to Alexa.

The users prompts the Alexa Skill to log certain sensors and can control actuators. Data can be captured between a start and end time and date. Additional sensors can be enabled even while a datalog is ongoing.

This was my first adventure into coding for the Internet of Things, JavaScript, NodeJS, and Amazon Web Services. As this project was initiated to compete in the The Alexa and Arduino Smart Home Challenge, I chose the Arduino Yún as the cornerstone of the project.

This is the all-in-on smart home device. You can be in charge of setting up your lights, temperature, and other sensors and have them trigger events. The LDR can trigger lights to come on and actuator a motor to move your shades up or down. If we had a sound sensor, it could e-mail you when your dog was barking outside.

The Plan

After some research, I wanted to utilize the Arduino Yún using the Amazon AWS IoT SDK. I chose to use JavaScript and Node.js to program the Alexa Skill, AWS Lambda and AWS IoT functions. I should probably point out that I had no experience in either of these languages before starting - if I can do this, so can you!

The objective was to create a skill that enabled a user to prompt Alexa to record data from a given sensor that was attached to the Arduino. There would be an option to enable an actuator if a certain trigger value was met. The program would datalog and send an email.

1. Alexa Skill and Lambda Function

I chose to do a custom Alexa Skill. This skill triggers events in an AWS Lambda function.

Users initiate dialog by saying "Alexa, open SciJoy Logger." This starts the launch intent in the Lambda function, which asks the user to specify what sensor they would like to use. The Lambda function delegates dialog. This means it takes over control and makes sure all the required data slots are filled. It fills the sensor type, the duration to log the sensor, the sample rate, the threshold value, whether the threshold is a min or a max, and if the use wants to trigger an actuator with this sensor.

If the user wants to trigger an actuator, they are prompted to name an actuator. They then fill in all the slots for the actuator.

In the Lambda function, I use the id values for many of the slots. This lets me set sensor and actuator types to integer values and makes sure that the data is normalized and not using any synonyms. I also translate the duration values to milliseconds so the Arduino can use them.

The sensor and actuator intents send updates to the AWS IoT Thing Shadow.

2. IoT Shadow and the Pi

This shadow logs updated user values from the Lambda function. We have a Raspberry Pi 3 subscribed to this shadow. It looks for delta values between the desired and reported states. The Pi takes the delta values, parses out the JSON parts of the shadow. The is reconstructed into a string, which is sent over serial to the Yun. The Pi reports back the status of the shadow.

3. The Yun

The Yun read the shadow values sent by the Pi. The Yun's sketch takes monitors the sample rate and records analog values from the sensors. These values are logged into a Google Spreadsheet using Temboo. If a sensor values crosses a threshold, the person is e-mailed an alert. If a trigger values is crossed for an actuator, the actuator is started.

Future Plans

I plan to continue to refine this project. The Lambda should be a state machine with more error checking. The state machine will allow users to have more decisions. There will be more sensors added. The sensors could be connected to the Yun via WiFi or radio to enable longer distance use.

I am also a firm believer in accessible technology and I want to explore the voice-enabled features for future projects.

Code

Schematics

Schematic
Fritzingscijoyalexayun fnqa1h0q3a

Comments

Similar projects you might like

Temperature and Humidity Data Logger

Project tutorial by Wimpie van den Berg

  • 23,410 views
  • 2 comments
  • 22 respects

WalaBeer Tank

Project tutorial by Balázs Simon

  • 23,113 views
  • 4 comments
  • 159 respects

Intelligent Door Lock

Project in progress by Md. Khairul Alam

  • 15,963 views
  • 19 comments
  • 95 respects

SD Card Temperature Data Logger

Project tutorial by 3 developers

  • 8,644 views
  • 0 comments
  • 9 respects

Energy Data Logger

Project in progress by Javi D'Ambra

  • 3,690 views
  • 5 comments
  • 9 respects

Animated Smart Light with Alexa and Arduino

Project tutorial by Bruno Portaluri

  • 3,652 views
  • 9 comments
  • 23 respects
Add projectSign up / Login