Roombaduino – part 25 – Follow-up

A long while back, I demonstrated how to multiplex 2 OLED i2c displays which have the same i2c address. The video is here:


I was asked a couple of questions in the comments about how it worked.

Firstly, when the data has been sent to the display, does it stay there? That is do you need to refresh it?

Secondly, are both OLEDs able to share the SCL (clock) line?

I’ll answer in reverse order. Yes and No. 🙂

As I explained in the video, all the devices you want to multiplex share the clock line. The SDA (data) line is what is multiplexed.

For the actual data being sent, there is no need to refresh it. I don’t have the exact details on exactly how that information is stored ( who reads datasheets? ) but the code I used for the video demonstration is below and I don’t refresh anything.


#include <Wire.h>
#include <OzOLED.h>

#define MUX1 6
#define MUX2 7
#define MUX3 8

#define NUM_SCREENS 2
int screen = 1;
int i = 1 ;

void setDisplay( byte displaynum )
 digitalWrite( MUX1, (displaynum & 0x01 ? HIGH : LOW) );
 digitalWrite( MUX2, (displaynum & 0x02 ? HIGH : LOW) );
 digitalWrite( MUX3, (displaynum & 0x04 ? HIGH : LOW) );

void setup() {

 pinMode( MUX1, OUTPUT );
 pinMode( MUX2, OUTPUT );
 pinMode( MUX3, OUTPUT );

 for( int s = 1 ; s <= NUM_SCREENS; s++ )
 setDisplay( s );

 // Rotated 180 degrees
 OzOled.sendCommand( 0xC8 );
 OzOled.sendCommand( 0xA1 );
 OzOled.sendCommand( 0x0DA );
 OzOled.sendCommand( 0x012 );
 OzOled.setBrightness( 0xFF );

 OzOled.sendCommand( 0x8d );
 OzOled.sendCommand( 0x14 );


void loop()

 setDisplay( screen );


 OzOled.printNumber( (long)i );
 if( screen > NUM_SCREENS ) screen = 1;

Roombaduino – part 24 – Simple UI

I took a little time to look at the design for a simple UI for the Roombaduino. I needed to know the voltage level, which brushes are in operation and what mode the Roomba is in.

During this, I was getting a notification from the Arduino IDE that I was going to run low on memory using the example sketches and some of this is down to including the Serial library for debugging output. Once I stopped using that, the sketch was at 44% memory usage compared for 65%. Given that the amount of memory available

Roombaduino – part 20 – Soldered LED Module

After breadboarding the LED module, I started on soldering the components. It was after I’d soldered everything and was finishing wiring the connections that I discovered that some joker had replaced my 16-pin sockets with 14-pin sockets and I was missing 2 pins for the last 2 LEDs. There was much wailing and gnashing of teeth as I started again.

This time I made sure I counted the pins and was able to complete the module in a couple of hours.

The ATTiny85 was still running the sketch to count in binary from 0 to 255 so that acted as a great test that the micro controller could control the shift register.

All that was left was to change the sketch so that it could read the data from the main MCU and output a byte to the LEDs. As luck would have it, the value of the button state can be directly applied to the LEDs so that the corresponding LED lights up without any need for translation.

WARNING: There are flashing LEDs in this video.

I build a simple bus with 8 ports where 1 port is connected to the main MCU and the other modules can just plug their 4 pins into one of the other connectors. I’ll make up some simple cables so that I can stop using my breadboard wires.

Next step is to build a joystick module with an ATTiny84 ( with more pins ).