you're reading...

Uart Sensor using Sparkfun Pro Micro

2014-08-24 12.46.00

Here is an example of an EV3 UART sensor based a Sparkfun Pro Micro Arduino clone and a Dexter Industries breadboard adapter. It uses the EV3UARTEmulationHard library. This could be used with a variety of cheap sensors. It is shown with an MQ-2 gas sensor. There is also a Bluetooth serial adapter. This could be used to access the sensor wirelessly.

The EV3UARTEmulationHard library is the same as the EV3UARTEmulation library, except that it uses hardware serial rather than software serial. It is suitable for Arduino devices like the Leonardo or the Sparkfun Pro Micro or the Mega, that have a Serial1 hardware UART. For those devices, the USB Serial device can be used for diagnostics and Serial1 can be used for the EV3 communication. Hardware serial should be able to support high bit rates than software serial.

The Arduino code for this device, using EV3UARTEmulationHard is:

#include <EV3UARTEmulationHard.h>
#include <Serial.h>

EV3UARTEmulation sensor(&Serial1, 99, 38400);

void setup() {
  sensor.create_mode("TEST", true, DATA16, 1, 3, 0);

unsigned long last_reading = 0;

void loop() {
  if (millis() - last_reading > 100) {
    int r = analogRead(0);
    Serial.print("Reading: ");
    last_reading = millis();


No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

About leJOS News

leJOS News keeps you up-to-date with leJOS. It features latest news, explains cool features, shows advanced techniques and highlights amazing projects. Be sure to subscribe to leJOS News and never miss an article again. Best of all, subscription is free!
Follow leJOS News on WordPress.com
%d bloggers like this: