Using the generic board (with the yellow jumpers) with code written for the Maple Mini
The generic board was tested with code from here - with thanks to Ray Burnette
A Nokia 5110 GLCD displays the output of a BMP180 pressure and temperature sensor.
(All of my eBay Chinese Nokia boards were not securely fastened to their circuit board.
If you press the edges the contrast can change to black - then fade randomly.
I squeezed my board and LCD together while soldering the 4 lugs
- then changed the contrast setting to get a good display - see the code - it is now very stable
)
Wiring the display, barometer and i2c lines -
Maple Mini | Nokia 5110 | Generic board * | ||
PIN_SCE | 31 | CE (Active High) | pin 2 | PB12 |
PIN_RESET | 30 | Reset (Active Lo) | pin 1 | PB13 |
PIN_DC | 29 | Data==1 Command==0 | pin 3 | PB14 |
PIN_SDIN | 28 | MOSI/DIN | pin 4 | PB15 |
PIN_SCLK | 27 | CLK/clock | pin 5 | PA8 |
Maple Mini | Function | Generic board * |
16 | SCL | PB7 |
15 | SDA | PB6 |
25 | RXD (connect to TXD on USB-RS232 board) | PA10 |
26 | TXD (connect to RXD on USB-RS232 board) | PA9 |
32 | Button 2 (not the reset button) | PB8 |
* the P may not be shown on the board lables but is needed in the code
A full list of which pins connect to the Maple Mini board pins is here
Notes (with thanks to help from Ray Burnette)
I placed all these files from the zip into a single folder -
GLCD5110_BMP085.ino
BMP085.h
BMP085.cpp
I2Cdev.cpp
ScrnFuncts.ino
Licenses.h
The main code is GLCD5110_BMP085.ino which incorporates any other .ino file in the same folder without calling for it (new to me!)
Because the supporting .h and .cpp files are in the same folder they do not need to be in the libraries folder. This means we can use modified versions for these files without confusing the other programs calling on the library.
#include <Wire.h> - means use the legacy version in the library.
#include "BMP085.h" - means use the modified file in the same folder as the main .ino
These lines are equivalent
#define PIN_SCE PB12 // CE (Active High) // pin 2
#define PIN_SCE 31 // CE (Active High) // pin 2
31 is the Maple Mini pin number and can be left in the program even if the board is generic.
The IDE inserted into the Arduino IDE is really designed for the Maple Mini and converts 31 to PB12.
My code stopped running originally at isButtonPressed - I guess this must be predefined in the IDE.
BOARD_LED_PIN must also be in the IDE so I inserted the pin PC13 for the generic board LED.
The modified code GLCD5110_BMP085.ino that runs on my generic board is -
/* #include <Streaming.h> // http://arduiniana.org/libraries/streaming/ Documents\Arduino\libraries\Streaming (legacy) //next line generic - #define LED_PIN BOARD_LED_PIN // defined for LeafLabs Maple & Maple Mini ... Real Arduinos it's PIN 13 #define DIAGS false // set to "true" to echo diagnostic to SerialUSB - renamed to Serial /* Nokia GLCD SOFTWARE SPI (using Maple Mini hardware SPI 2 Pins) #define LCD_C LOW // global GLCD variables // Various static Screen messages // create barometer object void setup(void) // I2C Stuff void loop(void) // wait appropriate time for conversion (4.5ms delay) // read calibrated temperature value in degrees Celsius // request pressure (3x oversampling mode, high detail, 23.5ms delay) // read calibrated pressure value in Pascals (Pa) // display measured values if appropriate // blink LED to indicate activity // update GLCD nRow = nRow - 1; nRow = nRow - 1; nRow = nRow - 1; delay(1000); // wait 1 second before repeating... |
With #define DIAGS true serial output was seen on the Arduino IDE serial monitor on pins UART PA9 PA10 that were used to upload the program.
Please email me if you want to swap notes