HowTo: Control Fan with S5D9 and IoT Sandbox Dashboard

s5d9

#1

This tutorial shows you howto use the Grove connector on your S5D9 IoT Fast Prototyping Kit to control a 5 volt fan using the Renesas IoT Sandbox Data Intelligence Dashboard (Medium One) and the pre-built binary from Medium One Diagnostics Intelligence. This project can be modified to control 12 volt accessories such as bigger fans, electrical motors, or an alarm system.

A natural extension of this project is to control the fan using the sensors of the S5D9 by modifying the Python workflows.

On the Data Intelligence dashboard, send a 1 on the Toggle panel to start the fan and a 0 to stop the fan.

In the example below, I am using lightweight cloth to provide a visual indicator when the fan runs.

Hardware Parts

  • S5D9 IoT Fast Prototyping Kit
  • 200 ohm resistor (probably a bit too low and a 330 ohm might be better)
  • 5 volt fan I used this one. $8 for two fans
  • 5 volt power source. I’m powering my breadboard with something like this. $5.49 with free shipping
  • 2N3904 NPN bipolar junction transistor or equivalent. I’m using this kit
  • 1N4148 diode or equivalent. I’m using the part from the kit above
  • Grove cable. I’m using 1 piece from this pack
  • Breadboard and jumper wires. You can get 4 breadboards and 120 pieces of wire in a pack like this

Software

  • Medium One Diagnostics Intelligence S5D9 .srec binary. (free). You need an USB cable to transfer the .srec binary to your S5D9 board
  • Renesas IoT Sandbox Data Intelligence. Click here to activate the Diagnostics Intelligence Kit (free)

Prerequisite Tutorial

Recommended Tutorials Before Starting This Project

The pre-built Diagnostics Intelligence tutorial outputs 3.3v to the Grove connector. We will use that as a trigger to control a higher voltage accessory. There are many tutorials on how to control the 3.3volt Grove connector and blink LEDs from the cloud dashboard.

Circuit Overview

The key part of the circuit is a transistor

I’m using the 2N3904 NPN bipolar junction transistor from this kit. You’ll also need a diode like the 1N4148 diode .

I’m basing the circuit on this schematic from the Internet.

I first tested it with an LED connected to a 200 ohm resistor to make sure that I could toggle the LED with the 3.3v signal going into the base lead of the transistor. The base lead is most likely the center lead of the transistor. The flat part is facing toward me. I’m running the 3.3v trigger signal through a resistor to be safe.

Once the circuit works with an LED, test it with an electric motor or fan. In the picture below, I’m running the 3.3v trigger line through a 200 ohm resistor.

Replace the 3.3volt trigger wire with the white (pin 2) wire from the Grove connector on your S5D9.

Use the J3 connector, the side closest to your Ethernet connector.

Connect pin 4 of the Grove connector (black wire) on your S5D9 to the emitter lead on your transistor (the left lead if the flat part is facing you).

Power your S5D9 with USB and connect the Ethernet. Your circuit is complete.

If you have any doubts, connect the pins to a voltmeter.

Data Intelligence Dashboard Configuration

Assuming that you went through Renesas Cloud-Driven GPIO with External LEDs, you’re done and can now test your fan.

Typing in 1 will turn on the LED.

If you haven’t gone through the Renesas Cloud-Driven GPIO with External LEDs tutorial, the modification is easy.

Create workflow

First create a new workflow and then copy the Python code from LED Toggle and Blink into your new workflow.

Your new workflow will look like this. Double-click on the blue Python box.

Change the code using the example below as a reference.

if IONode.is_trigger('in1'):
    toggle = IONode.get_input('in1')['event_data']['value']
        MQTT.publish_event_to_client('s5d9', 'G4:11:1;G1:1:1') # sets pin 4_11 high and pin 1_01 high
        log("Grove connector on")
    elif toggle == 0:
        MQTT.publish_event_to_client('s5d9', 'G4:11:0;G1:1:0') # sets pin 4_11 low and pin 1_01 low 

Select Save and Activate

Completion and Next Steps

Congratulations, you’ve just created a project to control a 5 volt accessory using a Python workflow on the Renesas IoT Sandbox Data Intelligence system. As the Diagnostics Intelligence binary is receiving sensor data from the S5D9, it’s now possible to control an accessory based on sensor input. This is a great challenge for you.


Transitor and Diode Circuit to Control Fan?
#2

Using much larger fan.

This is a used 12V computer fan 120mm in diameter. I soldered new electrical leads onto the fan to make it easier to experiment with.

I now have the S5D9 connected to the Internet with WiFi using an IOgear Ethernet to WiFi adapter.