Hi,
I want to use a SSD1306 Oled display from adafruit (http://www.adafruit.com/products/326#Description)
This display works with my UNO board but i can't get it to work with the Moteino. The display only shows text or graphics after power on and then freezes. So it won't show a next line of text or graphic. If i reset the board then it won't show anything at all (have to power cycle it).
Any idea what the problem might be and how to solve?
Kind regards,
Jacco
Hi Jacco. That display needs 5V power. Looks like they have an onboard regulator which brings that down to 3.3V for the display to operate with.
Other than that it should really work the same. Arduino UNO has the same chip as Moteino R2/R3, except Moteino is all 3.3V including data signals. So that might be a problem if that board divides the data lines from 5V to 3.3V - then if you connect 3.3V data lines those would get divided lower and would be invalid signals.
Here's what the Adafruit description of that OLED includes, confirming what I said before:
The driver chip, SSD1306 can communicate in two ways: I2C or SPI. The OLED itself require a 3.3V power supply and 3.3V logic levels for communication, but we include a 3.3V regulator and all pins are fully level shifted so you can use with 5V devices!
So yeah - Moteino will send 3.3v signals which get divided by a 5/3.3 ratio, so those signals will be too low for the OLED to pick up. Too bad they don't have a 3.3V version without the regulator.
You could probably hack it and remove or bypass the onboard regulator and level shifting, but don't do it unless you know how to do that.
Hi Jacco,
I have the following OLED display based on the SSD1306 which should be equivalent to Adafruit's display:
http://www.ebay.es/itm/161051456501?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1497.l2649
I made the following conections:
Moteino | Oled |
| 13 | RES |
| 12 | CS |
| 11 | DC |
| 10 | SCL/CLK |
| 9 | SDA/DATA |
| GND |
3V3
I used the libraries from adafruit and the example ssd1306_128x64_spi and It works perfect. As I said before, the modules should be equivalent.
Are you using the same configuration/libraries?
(http://farm6.staticflickr.com/5540/9679309609_5ef1438fa8_o.jpg) (http://www.flickr.com/photos/15304611@N03/9679309609/)
Moteino R2 + SSD1306 OLED display (http://www.flickr.com/photos/15304611@N03/9679309609/) by FelixRusu (http://www.flickr.com/people/15304611@N03/), on Flickr
(http://farm8.staticflickr.com/7359/9682546502_62b918d754_o.jpg) (http://www.flickr.com/photos/15304611@N03/9682546502/)
Moteino R2 + SSD1306 OLED display (http://www.flickr.com/photos/15304611@N03/9682546502/) by FelixRusu (http://www.flickr.com/people/15304611@N03/), on Flickr
Hi Guys,
If i read the description on the adafruit site it says "It's easier than ever to connect directly to your 3V or 5V microcontroller without needing any kind of level shifter!". So you should think (at least i do) that it works out of the box with the 3.3V Moteino R3.
I had a Bi-Directional Level shifter lying around so i used that to hook on the Oled at 5V...still no luck.
The OLED on ebay looks indeed the same. I've already tried the example ssd1306_128x64_spi. This works but only after a power cycle. A reset (or upload) and the OLED stays black.
If a take a working sketch and i include the libraries for the OLED and only declare the class (no code to use it), my sketch stops working. Serial.println won't show the welcome message and that is the first instruction. And that is even without wiring the display.
@jaime: did you try anything else than the example.
Also, are we allowed the use pin 10 as that is SS of the radio?
Thanks for your help so far.
Jacco
Hi,
I'm sorry but I don't understand correctly your problem. Can you explain the process? i.e: 1. upload sketch and working, 2. reset and doesn't work....
I haven't done much testing due to time issues, sorry. If you want me to try some scketch it's ok for me, post it and I try.
About pin 10, you are almost right. Both modules (SSD1306 and RFMXX) uses SPI. SPI allows multiple devices using the same bus, the "active" module is the one with they SS low. So if you want to use both modules, you need to modify one library to use a diferent SS pin and do some manual control of the SS pins to assure that when you are using one module, the other's SS pin is in high.
I'm almost sure of this, but correct me if I'm wrong.
Hi,
Thanks for your offer to try the sketch.
I put an ATMega328 on a breadbord, hooked up the oled and let the processor and display run at 3.3V.
Loaded the examples of different SSD1306 libraries. They all works fine.
This confirms that the Moteino running at 3.3V should also work.
I loaded the test sketch in the Moteino R3 and the sketch runs fine with oled display showing correct information.
One thing behaves differently though, after loading the sketch in my UNO on a breadboard the sketch starts running with the display working. After a reset it works ok.
On the Motino, the sketch starts running after I load it but the display is dead. After a power cycle the sketch runs and the display is alive. After a reset...display is dead again.
But...I can live with that.
Then when I put in the code to initialize the radio (radio.initialize(FREQUENCY,NODEID,NETWORKID)) things go wrong.
After the init routine of the radio the display freezes.
The same behavior on the UNO on a breadboard (which doesn't have a RFM69 chip).
I attached my test sketch.
Any help is appreciated.
Jacco
Your data lines look OK to me.
It might be possible that there is crosstalk on the MISO line. A simple check would be to put pulldown resistors on the MISO and MOSI lines, 10K values should be good.
Isn't that OLED also supposed to work on I2C? If so did you try that?
One thing to note is that Moteinos will also use SPI in the bootloader to check for a FLASH image on the FLASH chip, that's even if the FLASH chip is not present. So if the OLED is somehow sensitive to that then that might be an issue. I would start with the pulldown resistors as mentioned above.
I can't image power draw is an issue. Sounds to me like there's a problem with the SPI and the OLED.
Indeed it is a SPI conflict of some kind.
When any of the following lines get executed the display freezes (or garbage on screen):
SPI.begin();
do writeReg(REG_SYNCVALUE1, 0xaa); while (readReg(REG_SYNCVALUE1) != 0xaa);
do writeReg(REG_SYNCVALUE1, 0x55); while (readReg(REG_SYNCVALUE1) != 0x55);
for (byte i = 0; CONFIG[i][0] != 255; i++)
writeReg(CONFIG[i][0], CONFIG[i][1]);
setHighPower(_isRFM69HW); //called regardless if it's a RFM69W or RFM69HW
setMode(RF69_MODE_STANDBY);
while ((readReg(REG_IRQFLAGS1) & RF_IRQFLAGS1_MODEREADY) == 0x00); // Wait for ModeReady
Tried the 10K pulldown resistors. Didn't help. B.t.w. I'm testing an a UNO now. That has no RFM chip and no Moteino bootloader.
I avoided a possible power problem by also using an external power source.
Now trying the I2C option...
Thanks,
Jacco
...pulling my hair out here.
With I2C is doesn't work either. Display stops when the radio gets initialized. That is not really since I'm using an UNO without radio.
Thanks,
Jacco
Since it's an Adafruit product and Jaime has his OLED working, maybe someone in Adafruit's forum has had similar issues...?
Perhaps hooking up a logic analyzer would shed some light on what's happening on that SPI bus.
I posted this issue also in the Arduino forum...
I'm wondering if Jaime tried it in combination with the RFM69? I think he just tried the Adafruit example. Did you Jaime?
Unfortunately I don't have a logic analyzer so that's no option.
What I find strange is that when I use the I2C option it still doesn't work. SPI couldn't be the problem then? Or can it?
Tried something else...
I had two RFM12B radio's that I didn't use, connected them to two UNO's, one of them with the display (I2C).
Loaded the sketch, change the library form RFM69 to RFM12B...and it works. :D
But, it was quite late last night so I didn't have time to check stability.
The question is then, why does it work with the RFM12B library and not the RFM69? I hope I can figure this out since I have two Moteino R3's and no R2's.
Thanks for your help so far.
Jacco
I'm a little bit further...
Build my project (ATMega328, RFM12B and SSD 1306 Oled) on a breadboard and got it working as designed.
When a change the library from RFM12B to RFM69 (and leave the radio or remove it. I have no spare RFM69) the sketch hangs after the radio.Initialize.
The result is the same when I build the project with a Moteino R3.
Is there something you guys can think of what could be the problem.
Thanks,
Jacco
Did it work at 3.3V on the breadboard?
Does your Moteino R3 have a FLASH chip?
So it works with RFM12B but not with the RFM69W...
A logic analyzer would be perfect, would solve this issue almost 99% of the time.
Without basic tools to investigate the wires it's almost impossible to speculate and guess your way into solving problems like this.
Yes I work with 3.3V on the breadboard.
I have two Moteino R3, one with and one without a Flash chip. Results are the same.
Yes it works with the RFM12B and not with the RFM69W.
Hmmm...I don't have an analyzer so that route isn't an option for me.
So I'm stuck for now. :(
The easiest (and probably only) way for me is to order two Moteino R2's ;)
A logic analyzer is a really nice tool to have when doing electronics.
They say it needs 1K of ram on the MCU since it's a buffered display. I'm wondering if that's a problem. The RFM69W might require more RAM than RFM12B.
I looked a little at the datasheets and it looks like it's using quite a bit of power, unusual for such a small OLED display which I believe is more power efficient than non-OLED displays.
It's also not very cheap...
Really not sure what else to suggest. I feel like a mechanic trying to diagnose a car problem over the phone :)
I'm sorry, I can't make the tests until the weekend :( I will try then and post the results.
Yeah. I would love to have a logic analyzer. But for a newbie hobbyist like myself it's too expensive for me to buy at the moment.
I measured the current but it's very low. So low that my tool can't read it. Setting at uA.
Of course it's not easy to diagnose over the phone :). I'm happy that you were trying :)
One question about the memory...can this be a problem without the RFM69 connected and just using the library and calling initialize?
@Jaime: thanks in advance for testing.
Thanks,
Jacco
You mean the FLASH memory?
Not sure what exactly the scenario is, but if you don't have a radio on the Moteino then calling radio.initialize won't work since there are some while loops that assume the radio is installed, and will stall execution until they respond.
For the FLASH, flash.initialize() won't do anything.
No I was referring to your remark about it being a buffered display and it could be a memory problem.
Anyway...I'm stuck. I ordered a pair of R2's (without radio as I already have those).
So I will build my project with RFM12B as that seem to work on my breadboard.
Now let hope it will also work on the R2's.
Thanks,
Jacco
I suggested using pullups on the CS, MOSI and MISO (10k works...) and a user reported to me the OLED started working.
His OLED was working without the RFM radios but not with the RFM radios. When pullups were added it all worked. Just thought I'd mention that here.
Could it be that it's setting in the ISR?
BTW, check this out. http://www.gadgetfactory.net/logic-sniffer-2/
If you always wanted a logic analyzer, but didn't want to caugh up big $, this could be for you. $50. Looks cool.
je
Hi,
A week ago I received the R2's.
Before I build my project with the R2's instead of the R3's I did one final attempt to get it to work with the R3.
And guess what? It suddenly worked :D
The sad thing is that I don't exactly know why it didn't worked in the first place. My guess it was the wiring eventually.
Anyway...I'm happy now.
@John: thanks for link. I will keep this in mind the next time I run into these kind of troubles.
Thanks.
Jacco
Heh... good to know it works now. Could you perhaps add any details how you wired it, so it remains for posterity?
This is how my peripherals are connected to the Moteino.
#define FANSPEED_PIN 5
#define ENCODER_1_PIN 3
#define ENCODER_2_PIN 4
#define ENCODER_SWITCH_PIN A2
#define OLED_DC 6 // DC=A0
#define OLED_CS 7
#define OLED_MOSI 11 // DATA
#define OLED_CLK 13
#define OLED_RST 8 // NC for the OLED library I'm using
#define LED 9
I'm using the U8GLIB library for the OLED. The initialization string is as follows (hardware SPI):
U8GLIB_SSD1306_128X64 oled(OLED_CS,OLED_DC);