Using the Bean for the first time?

You’ll need to follow some special instructions to get started.

Communicate with the Bean

The Bean has two easy methods of Communication

Wireless Serial

Wireless serial is the most often used way to communicate. The native Arduino Serial Library communicates with your BLE device using a virtual serial port. When using the loader app, you can enable this serial port in OS X as /tmp/tty.LightBlue-Bean. All the nitty gritty protocol serial-BLE-serial bridging is taken care of for you in the background.

1. The Serial-BLE Bridge

2. Program the SerialLoopback Sketch

Clicking “Upload” in the Arduino IDE, will bring up the Bean Loader App.

Select the Bean you want to upload your sketch to, double click to connect.

Right click and select Program Sketch to upload the SerialLoopback sketch to your Bean.

3. Setting Virtual Serial

4. Select Serial Port

Navigate back over to the Arduino IDE

      Go into the Tools Menu->
      Inside the Serial Port->
      Select “/tmp/tty.LightBlue-Bean”

This is the LightBlue Serial Port that you just setup.

5. Arduino Serial Monitor

Scratch Characteristics

We have added five “Scratch” Characteristics that can be used to send any type of data to your devices.

Using the LightBlue application, you can easily read and write data to these characteristics.

Read through the Arduino Reference for more functions.

The Arduino Bean Library

We have included an Arduino Bean Library that can be used to:

Digital I/O and I2C/SPI Buses

Here’s a diagram of the pinouts:

  • To read the digital/analog pins, you use the regular Arduino digitalWrite/Read and analogWrite/Read functions you may already be familiar with.
  • analogWrite is actually used on PWM pins which are digital pins
  • The I2C and SPI bus libraries use the PWM pins as well.
  • Wire your own battery with pins BAT and GND as V+ and V-, respectively.
  • The Bean doesn’t have an on-board voltage regulator, so be sure to limit voltages between 3.0V and 3.6V.
  • A0 and A1 are your typical analog input pins.
  • D0-D5 offer 6 digital I/O pins.
  • A0 and A1 can also be used as digital I/O, giving you 8 digital I/O total.
  • Digital pins 0-3 can be used for PWM and “analog” outputs (analogWrite is really just a digital PWM output).
  • SPI and I2C share these same 8 pins.
  • SPI is on D2-D5, whereas I2C shares the A0 and A1 analog pins.
  • Connecting both a SPI and I2C device to your bean should still leave you with 2 digital I/Os.

  • The pins below the A0-1 and D0-5 pins are protoboard pins that are isolated from one another and the Arduino.

A Systems View of the Bean

To understand why the Bean library is used for certain features, we should take a look at a systems view of the Bean. This is all done behind the scenes to make the Bean easy to use.

Bean Systems Diagram

The LBM313 –
Low Energy Bluetooth Module

The LBM313 is the heart of BLE communications, it communicates with the BMA250, an accelerometer and temperature sensor, as well as sets the intensities of the RGB LEDs.

The LBM313 handles all BLE traffic to and from the Arduino.

The Bean is designed this way to free up the digital and SPI/I2C bus pins on the Atmega328p, so they can be used freely in your projects.

Atmega328p –
The Arduino microcontroller

The ATMega328P on the Bean is running at 8MHz.

This is bridged to the LBM313 using serial communication (UART at 38400bps).

We have constructed a serial protocol that allows the LBM313 and Atmega328p to communicate both messages from the client (OS X, iOS, etc.) to the Arduino. As well as send special commands to the LBM313 to do things like read the temperature sensor and set the LED.

Still have questions? Want to collaborate with others on your project?

The Bean Talk forum provides a great resource for project ideas and technical help from the community!

Colin KarpfingerArduino User’s Guide