Author Topic: wireless / nRF24L01  (Read 23541 times)

kehribar

  • Newbie
  • *
  • Posts: 18
Re: wireless / nRF24L01
« Reply #15 on: June 07, 2013, 09:08:27 am »
Hi,

Take a look at this schematic: https://s3.amazonaws.com/digispark/DigisparkSchematicFinal.pdf

Atmel devices have following GPIO related registers:

DDRx -> Direction settings. (input or output?)
PORTx -> Setting an output value (high or low?)
PINx -> Reading an input pin (returns high or low?)

Since the Digisipark ( Attiny85) have only B port, All the registers will be

DDRB , PORTB, and PINB

Lastly,

You have to indicate which pins you are using.

Let's look at the 32th line of this file: https://github.com/kehribar/nrf24L01_plus/blob/master/rx_example/radioPinFunctions.c#L32

For example you connected CE pin of the nrf24 module to the 2nd pin of the Digispark. By looking at the schematic of the digispark, we are seeing that 2nd pin of the JP3 is connected to the PB1. Therefore you should edit the 32th line of the file as
Code: [Select]
set_bit(PORTB,1);
I hope you can figure out the rest.

If not, please let me know. :)

Best,
ihsan

PhragMunkee

  • Newbie
  • *
  • Posts: 2
Re: wireless / nRF24L01
« Reply #16 on: June 07, 2013, 06:37:08 pm »
DDRB , PORTB, and PINB


Thank you a ton for the info.  It is very helpful.  You also helped me realize the dumb mistake I made.  I did try to use "set_bit(DDRB,0)", but I didn't change the next line to also use DDRB (so it remained at DDRA).  When I tried to compile, it complained about DDRA.  What I didn't realize is that it was no longer complaining about the first DDRA (that I changed to DDRB) but the second DDRA and so on.


I guess I didn't double-check myself well enough.


Thank you!  Thank you!  Thank you!


I was planning on going to bed at a reasonable hour tonight...until now!  There is progress to be made!

Durandal

  • Newbie
  • *
  • Posts: 7
Re: wireless / nRF24L01
« Reply #17 on: December 09, 2013, 11:30:40 am »
Would the 2 I/O pins left open be enough for an RFID reader? I'm interested in making a mesh network of digisparks connected to various devices, talking to a DigiX communicating to a registry of users and permissions.

fidz91

  • Newbie
  • *
  • Posts: 1
Re: wireless / nRF24L01
« Reply #18 on: December 23, 2013, 12:25:27 pm »
Does anyone have a picture or schematic available for this?
I've got a couple of nrf24l01+ transcceivers and digisparks and would love to get them talking.
Many thanks in advance.

martyn_w

  • Newbie
  • *
  • Posts: 5
Re: wireless / nRF24L01
« Reply #19 on: January 01, 2014, 05:48:29 am »
I have this working, with a digispark sending (I checked receiving worked too) and an Arduino Uno receiving. The tricky bit is the 3.3 volt power for the nrf guy, but I simply used a voltage regulator (L78L00 series) and a couple of capacitors as in the test circuit in the datasheet here http://repositorio.utp.edu.co/dspace/bitstream/11059/2986/2/6213678C828_anexo.pdf.

Fixed the nrf24l01+ with the regulator to a proto board, with the nrf24l01+ GND on the proto GND and the 5 nrf24l01+ pins connecting to digispark pins 0 to 4, leaving just pin 5 free. However, if you leave the digispark connected to the usb for the power, then you will probably have trouble because pins 3 & 4 are used by the usb and toggling them for the nrf causes the usb driver (windows 7 in my case) to toggle the pins as well.  I found the radio worked occasionally with this contention going on but not very reliably.  Power with VIN and all was well.

I attach a couple of blurry pics and the digi and arduino sketches in case it helps.  Good Luck.

dougal

  • Sr. Member
  • ****
  • Posts: 289
Re: wireless / nRF24L01
« Reply #20 on: January 02, 2014, 08:09:20 am »
Sweet! Thanks for sharing. With that one pin left, you could make a wireless relay control. On the sending side, put a button, on the receiving side, the relay. I've been wanting to tap into the manual switch for my garage door for that, so we could have an extra garage remote.

bruceme

  • Newbie
  • *
  • Posts: 23
Re: wireless / nRF24L01
« Reply #21 on: March 12, 2014, 05:12:17 pm »
I have this working, with a digispark sending (I checked receiving worked too) and an Arduino Uno receiving. [snip]  Good Luck.

I had a heck of a time compiling this.  But I finally did, so I'll save you some time and share.   All prior posts are sadly misleading.  Here's how to actually get it to compile (as of 3/12/2014).

1 - Take the nrf24*.* from https://github.com/kehribar/nrf24L01_plus and put them into a folder called "nrf24" in your arduino install libraries or your personal libraries.
2 - Close _ALL_ open Arduino sketch editor winows and re-open your sketch
3 - Under Tools | Add Library... | nrf24 (bottom of the list)
4 - Per some of the earlier threads, rename:

#define PORT_ID         PORTB   // PORTB Data Register handles values of pins PB0 - PB5 on the DigiSpark(ATTiny 85)
#define PIN_ID          PINB       // PINB Data Register (read only)
#define DDR_ID          DDRB     // DDRB Data Direction Register handles input/output modes of pins PB0 - PB5 DigiSpark(ATTiny85)

because DigiSparks don't have a "D" port set, just a "B".

That should do it!  Compiled size for receiver is 2,480 bytes, tx was 1168, still plenty left to do more interesting stuff.

As for the wiring.  Per other posts, use this, it's a 3-pin variant and it uses a pretty LED to drop the voltage for NRF's 3.3.

http://nerdralph.blogspot.ca/2014/01/nrf24l01-control-with-3-attiny85-pins.html

Once I get this wired up, I'll update through successful tx/rx and final functional integration.

-B
« Last Edit: March 12, 2014, 05:16:20 pm by bruceme »