TDS Archive

An archive of data science, data analytics, data engineering, machine learning, and artificial intelligence writing from the former Towards Data Science Medium publication.

Follow publication

Member-only story

Interoperability Data-IoT: How to send and receive data and take control of your Arduino, from R

How to establish interoperability between R and Arduino (Data and IoT) through a data flow between both

Saúl Buentello
TDS Archive
Published in
13 min readMay 11, 2021

Photo: Receiving data from Arduino, in RStudio

What else could we talk about in common when we talk about R and Arduino, besides that they both share the letter R? Let’s start at the beginning, in case you are not familiar, is an open-source electronics platform based on easy to use hardware (Arduino board) and software (Arduino IDE). You can tell this popular card what to do if you have the correct type of data and a set of instructions to process the data and perform subsequent operations. The Arduino microcontroller is responsible for keeping all of your compiled code and executing the commands you specify. Arduino software, on the other hand, is the board’s IDE where the set of instructions governing the board is written. If this is your first time working with Arduino, I suggest you review this Getting Started to understand the minimum to continue with the examples in this article.

Before starting

Now, if you know R, you will know that an elegant language, well adapted to data analysis and data science. All that said, convergence can be achieved between the two: Data and IoT. This example is very simple, the objective of this article is to explore the interoperability between R and Arduino establishing a data flow between the two and having instructions in the microcontroller of the board, based on the received data. In this context, R will handle the data and everything associated with it, and send it to the Arduino. Arduino, on the other hand, will trigger peripherals based on the data it has received. How is this possible? Using the Arduino’s ability to be programmed directly through a serial port.

Before we begin, here is an overview of what will happen to demonstrate interoperability between R and Arduino:

  • First, you will send a series of data defining the brightness of 3 LEDs (in a range of 0% — 100%) from RStudio to the Arduino serial port.
  • An Arduino script will wait until serial data is available, extract the brightness values ​​for the 3 LEDs, assign them to analog values…

Create an account to read the full story.

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Or, continue in mobile web

Already have an account? Sign in

TDS Archive
TDS Archive

Published in TDS Archive

An archive of data science, data analytics, data engineering, machine learning, and artificial intelligence writing from the former Towards Data Science Medium publication.

Saúl Buentello
Saúl Buentello

Written by Saúl Buentello

#G3ekArmy, Web Developer & Data Enthusiast. Coordinador académico & Instructor. #KotlinCDMX Organizer. https://www.linkedin.com/in/sbuentello/

No responses yet