S5D9 HowTo: Renesas Cloud-Driven GPIO with External LEDs

s5d9
gpio

#1

Prerequisites

* S5D9 Diagnostics Intelligence Tutorial

Project Goals

  • Turn external LED on and off with 3.3v from Grove connector
  • Control the LED from the Renesas IoT Sandbox, Data Intelligence (Medium One)

What You’ll Learn

  • Electrical characteristics of Grove connector J3/UART GPIO
  • How to modify Data Intelligence workflow
  • Controlling Data Intelligence events
  • Basics of breadboard wiring, LED +/- pins, ground and power rails

Identify Grove Connector

Use the Grove connector closest to the Ethernet port. This is J3 and has a label called UART. On the schematic, it also says, GPIO next to the port.

Get wires for Grove Connector

You need some wires to do the test. On Amazon.com or a electronics parts site, search for “Grove connector”

Example.

Connect pins to voltmeter

Connect the white wire (pin 2) and the black wire (pin 4) to a voltmeter.

You do not need to use the yellow (pin 1) and red (pin 3) wires.

Wire the Breadboard

  • white wire (pin 2) goes on positive rail
  • black wire (pin 4) is ground and goes on the negative rail

There’s a bunch of extra stuff on this breadboard. Ignore the physical button and the second LED.

Plug the shorter pin of the LED into the ground (minus) rail. Plug the longer end to a resistor. Connect the other end of the resistor to the positive rail, which will be powered from pin 2 of the Grove connector.

Modify Data Intelligence Workflow Python Code

In workflow studio create a new workflow called Cloud GPIO. Copy the Python workflow and widgets from LED Toggle and blink.

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

Copy Python code from LED Toggle and Blink.

For this test, I modified the code as follows. Lines beginning with # are comments.

#Toggle 
if IONode.is_trigger('in1'):
    toggle = IONode.get_input('in1')['event_data']['value']
    if toggle == 1:
        # for example:
        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 

#         log("LED turned off")
#     else:
#         MQTT.publish_event_to_client('s5d9', led)
#         log("LED toggled")

Select Save and Activate

Dashboard

You can use the existing dashboard you built in the Diagnostics Intelligence tutorial.

On my dashboard, I added the Single User Real Time Events Stream to help with debugging.

You can now check for the toggle event.

Turning the LED On and Off

Typing in 0 will turn off the LED.

Typing in 1 will turn on the LED.

Reference

GPIO documentation from Medium One

GPIO

Interrupt driven GPIO input will be transmitted to the cloud to enable external peripherals such as buttons to be easily connected to the board GPIO output: The cloud can control a GPIO pin. On both grove connectors, pin 1 is an interrupt-input, and pin 2 is a controllable output.

#G = GPIO
#G<port>:<pin>:<level>

# for example:
MQTT.publish_event_to_client('s5d9', 'G4:11:1;G1:1:1') # sets pin 4_11 high and pin 1_01 high
MQTT.publish_event_to_client('s5d9', 'G4:11:0;G1:1:0') # sets pin 4_11 low and pin 1_01 low

Schematics from Seeed


Cloud GPIO for S5D9
S5D9 IoT Fast Prototyping Kit Tutorials
S5D9 HowTo: Cloud-driven Blinky
S5D9 HowTo: Use Amazon Alexa to Control External IoT Output
S5D9 HowTo: Variable Blinky from IoT Cloud Event
HowTo: Control Fan with S5D9 and IoT Sandbox Dashboard
Cloud-Driven Blinky Video Demo Overview
#2

Hello Craig

Is Okay to connect 3V motor on one of these GPIO ?

P4_10, P_411, P1_0, P1_1 ? As per above these PINs only available to connect outside.

Also to have PWM to control servo motors on this board GPT should be used to generate, but all the GPT available for this board don’t output these above GPIO. Whatever GPT mapped GPIO not available to connect.

For example E2Studio we can see GPT0 is mapped with 213, 415, 212, 414 etc. How do we access these pins ?

Another question is Grove B (j4) is combination of I2C/PWM. I think its okay to connect motor on this PIN?

Other option connect thru I2C motor board.

Mariya


#3

Medium One is working on a demo that uses PWM on the PMOD, J5. I believe this will be available in the middle of September. I think that will allow 5V motors to be used as well as servos.

The Grove connector isn’t supplying enough current to drive the 3V motor in my test. You’ll need to use the Grove connector pins as a trigger. I believe that something like this would work:

I have not tested it, but I would like to try it when I get time. In the schematic, the pin above the 2.2Kohm resistor should be one of the Grove GPIO pins. This schematic is not from a Renesas board.

I have a 3V motor and it doesn’t run off of the Grove connector.

This fan WON"T WORK off the current from the Grove connector.
http://a.co/aUSQGP2

Waiting for the code from Medium One is an option. Or, you can try and go ahead with the transistor and diode and see if it works. My preference would be to go ahead and try using the Grove connector as a trigger and build something with that.

When the Medium One code comes out, build another project.


#4

Wonderful and thanks for update and sharing details. I have one of that which came with raspberry PI3 case. I will try to check and see how to make this work.

But PWM there is not enough information about this board i.e. which PIN to map PWM out.

Mariya


#5

Hopefully, this will be clear when we get the code from Medium One. They may have figured it out from the schematic files.

S5D9 Kit Schematics Rev B.pdf (758.0 KB)

There’s also two headers that we might be able to populate with a cheap connector. These are not populated on the current board. it’s blank, but probably human-solderable with a header.