Kids love Particle Photon and Blynk

I've been looking for a tech project I could do with my kids (6 and 4 years old).

Firstly, because I think you cannot start with tech too soon. Secondly, because we all gotta sit at home #corona :)

Result

What will you need

Blynk.io

Blynk.io is a great playground for IoT - the app works on a phone (which is always a kid magnet anyway :). In the app you can add all kinds of widgets and connect them with your IoT device. All the interaction (reading or writing values) is a matter of seconds and drag and drop.

This is how the app I've created with my kids look like.

It has ZeRGBA widget on pin V1 (it allows to control the RGB LED of Particle Electron) and if you slide on the widget, it sends R, G, B values to V1.

I have also put a slider connected to pin V2 which controls how "fast" the other LED blinks. I've set it to work from value 5 to 2000 (milliseconds).

Code

The code is actually very simple - if you use Particle this should just work:

#include "Blynk.h"

char auth[] = "your code here";
int led1 = D6;
int del = 500;

/* Triggered by ZeRGBA widget and will set incoming R,G,B values to the RGB LED */
BLYNK_WRITE(V1)
{
  int r = param[0].asInt();
  int g = param[1].asInt();
  int b = param[2].asInt();

  RGB.color(r, g, b);
}


/* Triggered by the slider widget and will just set the delay between blinks */
BLYNK_WRITE(V2)
{
  del = param.asInt();
}

/* runs only once */
void setup() {

  // Setup the Blynk.io library
  Blynk.begin(auth);
  
  // Manual control of the RGB led for Particle
  RGB.control(true);
  
  // Setup the PIN where the LED is connected mode to WRITE 
  pinMode(led1, OUTPUT);
}

/* runs continously in a loop, as fast as possible */
void loop() {

  // Process Blynk messages
  Blynk.run();

  // turn on the LED
  digitalWrite(led1, HIGH);

  // we'll leave it on for given delay in millis
  delay(del);

  // then we'll turn the LED off
  digitalWrite(led1, LOW);

  // wait again with the LED off
  delay(del);
}
Matej Konecny

Matej Konecny

Dev, home automator and dad