It's cool just how much you can hang off a Trinket!
I now have a 3.3v Trinket talking too:
over I2C;
DS1307 Real Time Clock (includes 24C32 32K Bit I2C EEPROM memory which is also visible on the I2C bus)
HMC5883L 3 Axis Compass Magnetometer
PCF8574 - Remote 8-Bit I/O Expander for I2C-Bus
Over SPI;
OLED 128x64 SSD1306
23K256 SRAM Chip - 32K of lovely SPI accessible memory.
The SRAM provides a screenbuffer for the OLED module, which has no built in RAM. To draw the buffer to the display I read a 'page' worth of data (128 Bytes) at a time from the framebuffer and push these to the OLED, both over SPI. So a local 128 byte buffer is needed in the Trinket.
All the Trinket pins are in use so I use a small switch to disconnect #3 and #4 during proramming.
With SPI you need a separate Slave Select line for each device. These are provided by the PCF8574 which is an I2C IO Expander. I write to this first (over I2C) to select one of the output pins which act as Slave Selects for each SPI device. The outputs (I'm using 2) are then AND'ed with a single Master SS (on #3). This allows the individual SS's to be driven low by the master SS.
Code eequires a bit of jumping between I2C mode and SPI mode and both are using the serial hardware on the ATTiny.
The display in the photo shows the time, a compass reading and a time per frame in milliseconds. So it's running about 13fps with room for optimisation.
So all the chips you see are either I2C and SPI apart from a single 2-input AND gate, and the Cyberman,
Cheers
Rob
Trinket Extravaganza!
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- pocketmoon
- Posts: 78
- Joined: Fri Dec 27, 2013 8:21 pm
Trinket Extravaganza!
- Attachments
-
- trnk.jpg (253.65 KiB) Viewed 2255 times
- AnneBarela
- Learn User Page
- Posts: 753
- Joined: Sat Mar 24, 2012 8:56 pm
Re: Trinket Extravaganza!
Very impressive. How big is your code?
- pocketmoon
- Posts: 78
- Joined: Fri Dec 27, 2013 8:21 pm
Re: Trinket Extravaganza!
Hi,
At the moment I have about 20 bytes free. But there's a fair bit of debug code (flashing leds, etc) and duplicate code across the libraries. So next step is to refactor and trip out the fat.
Cheers
Rob
At the moment I have about 20 bytes free. But there's a fair bit of debug code (flashing leds, etc) and duplicate code across the libraries. So next step is to refactor and trip out the fat.
Cheers
Rob
- nataku
- Posts: 36
- Joined: Sun Feb 17, 2013 12:09 am
Re: Trinket Extravaganza!
Hi I am trying to do the same thing but just want to display temperature from TMP36 on the OLED display.
Can I ask you a few questions?
Are these the libraries to use?
#include <SPI.h>
#include <TinyWireM.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
I can't get it to compile and guessing the SSD1306.h is not compatible with the trinket.
Can I ask you a few questions?
Are these the libraries to use?
#include <SPI.h>
#include <TinyWireM.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
I can't get it to compile and guessing the SSD1306.h is not compatible with the trinket.
- pocketmoon
- Posts: 78
- Joined: Fri Dec 27, 2013 8:21 pm
Re: Trinket Extravaganza!
Hi,
I'll dig out the mods I made to get it to work. I think I just skip the display buffer and write straight to the OLED. Will post here when I get home this evening.
Rob
I'll dig out the mods I made to get it to work. I think I just skip the display buffer and write straight to the OLED. Will post here when I get home this evening.
Rob
- pocketmoon
- Posts: 78
- Joined: Fri Dec 27, 2013 8:21 pm
Re: Trinket Extravaganza!
Here you go!
https://github.com/pocketmoon/SSD1306NoBuffer
I based in on the SSD1306 libs here :
https://github.com/Hyvok/SSD1306-displa ... or-Arduino
and hacked out the display buffer :)
https://github.com/pocketmoon/SSD1306NoBuffer
I based in on the SSD1306 libs here :
https://github.com/Hyvok/SSD1306-displa ... or-Arduino
and hacked out the display buffer :)
- LarryXXL
- Posts: 1
- Joined: Mon Nov 03, 2014 5:23 pm
Re: Trinket Extravaganza!
HI
the SPI Sram 23K256 and a 400x240 SPI Sharp Memory Display makes me Problems. Can you tell me how the Adfafruit_GFX, SharpMem works with the SPIRam Lib ?
The 400x240 Display need minimum 12KB Sram for a full Frame before send to the Display.
thanks
the SPI Sram 23K256 and a 400x240 SPI Sharp Memory Display makes me Problems. Can you tell me how the Adfafruit_GFX, SharpMem works with the SPIRam Lib ?
The 400x240 Display need minimum 12KB Sram for a full Frame before send to the Display.
thanks
- seth10
- Posts: 19
- Joined: Tue Nov 04, 2014 10:32 pm
Re: Trinket Extravaganza!
Very impressive! Nice work
- ADAD_d
- Posts: 50
- Joined: Thu Oct 05, 2017 9:57 pm
Re: Trinket Extravaganza!
Hi there. I am attempting at `using a 23k456''s RAM for the display buffer of the SSD1306. Would I be able to see your code? Thank you.
- ADAD_d
- Posts: 50
- Joined: Thu Oct 05, 2017 9:57 pm
Re: Trinket Extravaganza!
Note: I am not sure if this makes a difference but I am also using the display over I2C and not SPI
Please be positive and constructive with your questions and comments.