Fork me on GitHub

eFirmata

Connecting the real world to the digital world.

Introduction

Compatable Hardware:

Protocols:

Example Projects:

Compiler

Installing the Binary

About / Credits / Contact

RGB Lights

You can use eFirmata to control some RGB lights from a smartphone:

Controlling RGB lights from a smartphone.



We will use a PHP script as an intermediate step:

The smartphone loads a webpage with JavaScript. The webpage makes AJAX calls to the server (the PHP script). The PHP script sends UDP packets to the eFirmata. The eFirmata controls the lights.

All of this code is in the directory:

     example_applications/RGB_lights_over_ajax/

(It would certainly be possible to build an app directly for the phone, which sends UDP packets directly to the eFirmata.)




Hardware: getting started

To start, we'll use some simple, regular LEDs. You can test your setup before buying any expensive, high-power LEDs.

Plain, simple, RGB LEDs.
(100% compatable with a regular mbed.)

This is the schematic:

The simplest LED circuit (for regular, little LEDs).
Resistors should be around 1K or 300 Ω or so.




Driving High-powered LEDs

The mbed itself (ie, the LPC chip itself) can only drive 3.3 volts at (perhaps) 10s of milli-amps. So if you want to power your 10 watt blue LED (and, who doesn't, really), you're going to need an output stage. An excellent solution is with a modern N-Channel MOSFET.

Driving a 12 volt LED

If you're using power LEDs that can be connected directly to a 12 volt power supply, (or even plain, ol', 12 volt lightbulbs), then the circuit is very simple:

12 volt LEDs (or even plain-old 12V lightbulbs) controlled via N-Channel MOSFETs

For our MOSFETs (Metal Oxide Semiconductor Field Effect Transistor), many different MOSFETs will work just fine, but there's a few parameters to keep in mind:

If you follow these criteria, then any N-channel MOSFET is just as good as any other N-Channel MOSFET.

Example devices:


Driving less-than-12-volt (but still high-power) LEDs

Some high-powered LEDs cannot be connected directly to a 12V power supply. In this case, you'll need something to limit the current (like a resistor, for example). You'll probably have to use Ohm's law to figure out what value of resistor you need. (Also, keep in mind that you'll probably have to use a higher-wattage resistor...)

Some high-power LEDs still need resistors to limit the current.

Resistor values will vary. (Right now, I'm using a setup with 1 Ω, 3 Watt resistors.)