The LightBlue Bean is a legacy product and is no longer being sold

The Bean loader apps will continue to function, but no further updates will be provided. Updates to your OS may change Bluetooth functionality and therefore may break the functionality of the Bean apps.

Hardware files are available here.

We're proud to have helped people prototype their products with the Bean, and for all the incredible things they've built. The Bean was an incredibly fun and challenging product to work on, and we will miss it..

Our goal at Punch Through is to help companies develop products. Our consulting services and software products have been growing so quickly that they require our full focus and attention. If you're developing a connected product, we'd love to help in any way possible.


Log Data on SD Card


This tutorial teaches you how to write data to an SD card using the LightBlue Bean.

The LightBlue Bean is an Arduino compatible microcontroller with integrated Bluetooth Low Energy that you can program wirelessly from your smartphone or desktop.

We will get the ambient temperature using Bean.getTemperature() and then save it in a text file on the SD card.

Before You Begin

This tutorial assumes you have completed the Getting Started guide and that you understand how to upload a sketch to Bean using Bean Loader.



You need either a Bean OR a Bean+ for this project.

  • iOS devicex 1
  • microSD card with microSD to SD adapterx 1
  • SD card breakout board (optional)x 1
  • Breadboard (generic)x 1
  • Jumper wires (generic)x 1
  • Male headersx 1
  • Female headersx 1
  • 2xAA battery holderx 1
  • 2 x AA batteriesx 1

Make it

Make your Bean breadboard compatible

To connect the LightBlue Bean to a breadboard, solder male headers to the back of the Bean. Then solder female headers to the front side on BAT, VCC and the two GNDs.

breadboard Bean

Solder the SD card

To wire the SD card to the breadboard we can either buy a SD card breakout board or solder male headers directly on the pins on the adapter. These are the pins we will need:

pins to solder

Take the male headers and put the short end against the pins on the SD card adapter. To avoid melting the plastic, put a drop of solder on the soldering iron and quickly put it on the SD card adapter pin and male header.

soldered SD card

Assemble the breadboard

Put the SD card and Bean next to each other on the breadboard. Put jumper wires from pin A0 – pin 5 under the Bean to cover the gap in the middle of the breadboard.

To connect the SD card to the Bean we need to wire the following pins to each other:

  • Pin 2 – SS
  • Pin 3 – MOSI
  • Pin 4 – MISO
  • Pin 5 – SCK
  • VCC – VCC

Also connect the two GNDs on the SD card to GND on the breadboard and then connect the batteries to BAT and GND on the Bean.

This is what the final wiring should look like:

wiring diagram (illustration made using Fritzing)

Modify SD library

To read the audio files from the SD card we will use the SD library that is preinstalled in the Arduino IDE. We will need to modify it a bit though to use it with the LightBlue Bean.

To find the library, navigate to the Arduino app in Finder, right click the icon and choose “Show package contents”.

show package contents

From there, open Contents > Resources > Java > libraries > SD > utility > Sd2PinMap.h

modified SD library

Program Your Bean

Upload this code to your Bean:

 This example shows how to get the ambient temperature
 in degrees Celsius from the Bean's built-in temperature sensor 
 and log it on an SD card using the SD library.

 Please note that you have to modify the SD library to use 
 it with the Bean.

 In Sd2PinMap.h, line 278-281, change the pins to the following:
 SS_PIN = 2;
 MOSI_PIN = 3;
 MISO_PIN = 4;
 SCK_PIN= 5;

 This example code is in the public domain. 

#include <SD.h>

const int chipSelect = 2;
uint8_t temp;

void setup()
 // Check if the card is present and can be initialized
 if (!SD.begin(chipSelect)) {
    Serial.println("SD fail");

void loop()
  // Get the ambient temperature with a range of -40C to 87.5C
  temp = Bean.getTemperature();

  // Open the data file
  File dataFile ="datalog.txt", FILE_WRITE);

  // If the file is available, write to it:
  if (dataFile) {

  // If the file isn't open, send an error message over serial
  else {
    Serial.println("error opening datalog.txt");

  // Sleep for a minute before we read the temperature again

Test: put a file on your SD card!

To write data on the SD card, we need a .txt file that we can print it to.

Create an empty .txt file, name it datalog and load it to the SD card. Put the SD card in the adapter on the breadboard and collect that temperature data like there’s no tomorrow!

Learn More

If you have any questions about this project, the best place to ask is the Beantalk community forum.