We've already got lots of in depth guides showing you how to setup your Raspberry Pi from scratch. You can view those here.

Setup the Camera

Once you've got everything up and going, it's time to start setting up the camera on your Raspberry Pi. When you are logged into your Raspberry Pi via SSH, run the command sudo raspi-config. Press the down arrow key until you reach 5 Interfacing Options and press Enter.

Make sure P1 Camera is selected and press Enter.

When asked Would you like the camera interface to be enabled?, select <Yes>.

To exit, press the down arrow key until you reach <Finish> and press Enter.

Press CTRL+O (that's the letter o, not the number) to save the code, followed by CTRL+X to exit Nano. Back in your terminal, run the code by running the command node run-camera.js.

In the debugger in the Wia dashboard you should now see the Event appearing.

Build the Flow

In the Wia dashboard, we're now going to build the Flow that will detect happy faces. In the left side menu, click on Flows, then create a Flow called 'Detect Happy Faces'.

We're going to do the 4 following steps:
- Add a Trigger Node
- Add a Detect Faces Node
- Add a Run Function Node
- Add an Email Node

Add a Trigger Node

Drag across an Event node from the Triggers section. Hover over the node and click the gear icon to open the settings. Enter photo as the Event Name and click Update. Now add the devices you would like this trigger to apply to.

Add a Detect Faces Node

Drag across the Detect Faces node under Services and connect it to the Event node.

Add a Run Function Node

Drag across a Function node under Logic and connect it to the Detect Faces node.

Hover over the Run Function node and click on the gear icon to open the settings.

Copy and paste the following code block to detect smiles. Then click Update.