3

Adafruit carries a number of Bluetooth LE 4.0 modules in their store, notably the SPI (https://www.adafruit.com/products/2633) and UART (https://www.adafruit.com/product/2479) version. I have used the NRF24L01 module with ATtiny85 via SPI to transmit data in the past, and this uses 3 pins. I used the following setup to do so: https://www.hackster.io/arjun/nrf24l01-with-attiny85-3-pins-74a1f2.

My previous system consisted of ATtiny85s communicating with a receiver (Bluefruit Feather) via NRF24L01 radios. As the receiver got data, it sent it to an iPhone app that I wrote. Now, I would like to cut out this receiver and BLE straight to the iPhone, which supports multiple peripheral connections.

However, unlike the RF24 library, the Adafruit BLE SPI library needs the actual SPI library to compile correctly, which for some reason the RF24 library (this version: http://tmrh20.github.io/RF24/) doesn't. I don't quite get how the RF24 library can compile fine without the SPI library when targeting the ATtiny85 - Is there some way to get this to work similar to the RF24 library?

Alternatively, I think there is a way to do software UART on ATtiny85, which I know nothing about, so if there truly is no way to do SPI is UART possible?

I realize that this is a question best asked to Adafruit, which I have done, but I thought I'd post it here and see if anyone can help.

Thanks, Alex

  • Have you considered porting the BLE library to a USI library? – Ignacio Vazquez-Abrams Jan 20 '16 at 3:38
  • Use an SPI library that does support the tiny. Like e.g. github.com/jscrane/SPI – Gerben Jan 20 '16 at 10:20
  • Huh - I'll take a look at that SPI library and see. Thanks. – Alex Wulff Jan 20 '16 at 12:41
  • The ATtiny85 does not have an SPI port. It has an USI (Universal Serial Interface) that can be made to work like SPI (or I2C, or UART), but this needs some software support. – Edgar Bonet Jan 20 '16 at 14:33
  • Keep in mind that many of the BLE chips are themselves computationally comparable to an ATtiny. There's a good chance you can run your project itself on an nRF51822 - granted there can be some annoyances in setup but the mbed option should work even if you give up on the Arduino port. – Chris Stratton Mar 12 '16 at 1:45
0

I find the ATTiny85 working well with software serial port. Serial UART (or in fact any of the protocols like I2C or SPI) are just bit banging - and you can do that pretty well in software. Of course, having a hardware support makes things easier and faster, but there is nothing badly wrong with a software uart either. Except that you have to continuously check if there is some data arrives.

I was using software serial on Adafruit Trinket (ATTiny85) in various projects to talk to a Bluetooth 2.1 module, and it worked pretty well.

Here http://arduining.com/category/trinket-projects/ they use the same approach to talk to an ESP8266.

You may wish to look for the SoftwareSerial lib for Trinket, or in certain cases you may want to go for the SendOnlySoftwareSerial lib (send only, but smaller code footprint).

Also a hardware based serial lib is available: https://blog.adafruit.com/2013/09/30/hardware-serial-library-for-the-trinket/

  • Thanks, this is very good information. I tried out SoftwareSerial and it appears to be working. – Alex Wulff Mar 12 '16 at 0:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.