You will need to download the Arduino sketch for this project at the following link:
Unpack this archive to a directory and load the sketch in Arduino. Don't forget you also have to have the Adafruit_CC3000
At the top of the sketch are various define values which control the configuration of the sketch. You will want to set these defines as follows:
ADAFRUIT_CC3000_IRQ, ADAFRUIT_CC3000_VBAT, ADAFRUIT_CC3000_CS: Set these to the appropriate pins which are connected to the IRQ, VBEN, and CS pins respectively on the CC3000.
WLAN_SSID, WLAN_PASS, WLAN_SECURITY: Set these to the appropriate values for your wireless network.
AWS_ACCESS_KEY, AWS_SECRET_ACCESS_KEY: Set these to the values of your personal AWS account access keys.
- AWS_REGION: Set this to the region value of the SNS topic created in the previous step. You can see a list of region values in this table.
- AWS_HOST: Set this to the appropriate endpoint URL for the region of your SNS topic from this table.
SNS_TOPIC_ARN: Set this to the URL encoded value of the topic ARN found in the previous step. Note that this value must be URL encoded--you can use a tool such as this one to URL encode the topic ARN value.
IR_LED: Set this to the Arduino pin which is connected to the infrared LED.
IR_SENSOR: Set this to the Arduino pin which is connected to the infrared receiver.
The rest of the configuration values do not need to be modified to run the sketch. You can read the comments associated with each value to understand their meaning.
Compile the sketch and upload it to your hardware. Open the serial port at 115200 baud and you should see the hardware connect to your wi-fi network and wait for the bowl to become empty.
To test everything is working, block the IR LED & sensor for ~5 seconds (the default BOWL_CHECK_SECONDS
configuration). After unblocking the LED and sensor you should see serial output as the hardware sends a notification to the SNS service. Specifically the response from the SNS web service publish call will be displayed in the serial output.
Make sure you see a 'HTTP/1.1 200 OK' response from the SNS service in the response. If you see a response such as 'HTTP/1.1 400 Bad Request' or 'HTTP/1.1 403 Forbidden' the message did not
publish and you should check the AWS access key, region, and host values are correct.
Note that by default the sketch will only publish a notification once every 12 hours. This is to prevent too many notifications being published and potentially pushing your usage outside Amazon's free usage tier. You can adjust this rate limit by changing the PUBLISH_LIMIT_SECONDS
configuration value to a different period of time. Also be aware that this rate limit is not stateful and will reset if the power or Arduino is reset.
Once you see a successful publish your hardware is complete!
Continue on to learn about future work you can do with this project.