Dongle USB NRF2.4G e modulo NRF2.4 funzionano

Un pò di tempo fa un utente chiese se questo dongle USB NRF funzionasse.

Ne ho comprati due (cinesi della AI-Think, mi pare coinvolta anche con i ESP8266)
http://www.ebay.it/itm/331349375666?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1439.l2649
e mi funzionano con un modulo NRF24L01
http://www.ebay.it/itm/1PCS-NEW-NRF24L01-2-4GHz-Antenna-Wireless-Transceiver-Module-GOOD-QUALITY-M19-/291137250279?pt=LH_DefaultDomain_0&hash=item43c921e3e7

In ebay Francia trovato questo:
http://www.ebay.it/itm/281515555455?ssPageName=STRK:MEWAX:IT&_trksid=p3984.m1423.l2649
che ha un codice Arduino funzionante (il canale usato risulta il 28)

Questo il codice per Arduino (nel mio caso Mini Pro a 3,3V) con alcune mie modifiche:

#include <SPI.h>
#include <RF24.h>
#include "nRF24L01.h"

#define BAUDE_RATE 57600
#define LEDPIN 13

byte ledState = LOW;
unsigned long previousMillis = 0;
RF24 radio(9,10); // CE pin and CSN pin
unsigned char ch;

void setup(void)
{ delay(1000);
  Serial.begin(BAUDE_RATE); 
  //the usb dongle works by default at 1Mbit, so this can be any speed
  radio.begin();
  //wi-fi channel (frequency) and the address and the speed those are the default values, can be modified by user
  // To modify them send the following text to the terminal on which the usb dongle is: AT+SET=xxyyabcdefghij
  // xx is the channel
  // yy is the RF_SETUP REGISTER on nRF24l01 (on dongle there is BK2423, but works almost the same)
  // It sets the dB power level and the speed (default value 0x07 = 1Mhz, 0dB (maximum value)); 
  // ijghefcdab is the port (note that is in the reverse byte order)
  // all values are in hexadecimal
  // Example: to change to the default values use: AT+SET=28073443101001
  radio.setChannel(0x28); 
  radio.openReadingPipe(1,0x0110104334LL); //default value when the usb wifi dongle is plugged (can be changed by user)
  radio.openWritingPipe(0x0110104334LL);   //default value when the usb wifi dongle is plugged (can be changed by user)
  radio.setDataRate(RF24_1MBPS);
  //setPayload,enabledynamic,setcrc. These are hardcoded the same on usb wifi dongle. Cannot be changed by the user
  radio.setPayloadSize(32);
  radio.enableDynamicPayloads();
  radio.setCRCLength(RF24_CRC_16);
  radio.startListening();
  radio.printDetails(); //print the configuration
  pinMode(LEDPIN,OUTPUT);
}

void loop(void)
{ unsigned long currentMillis = millis();
  if(currentMillis - previousMillis >= 1000) {
    previousMillis = currentMillis;   
    ledState = (ledState==LOW ? HIGH : LOW);
    digitalWrite(LEDPIN, ledState);
  }   
  if ( radio.available() )
  { radio.read( &ch, 1 );    // const void* buf, uint8_t len 
    Serial.print((char)ch);
    radio.stopListening();
    //delay(5);
    radio.write(&ch,1);      // const void* buf, uint8_t len 
    radio.startListening();  //flush the rx buffer
  }
}

Ho anche provato 2 dongle tra 2 PC. Con due dongle su due PC diversi, e con un terminal seriale si comunica subito tra i due PC.

Interessante.

Dimenticavo: tra Arduino e PC ho provato solo usando cavo USB da 6 mt verso il Mini Pro (collegato allo stesso PC), quindi la distanza era "minima", 6 metri e dietro ad un muro (intramezzo) e non ho provato distanze lunghe.

E' però possibile impostare parametri come il baudrate, il canale radio, etc.. della chiavetta?

Se si è bloccati a 1 MBPS è un pò un peccato..

EDIT: Dal sito francese il Soc usato è un BK2433 e non un SoC della Nordic, è quindi compatibile nel senso di clone con gli nrf24... :frowning:

PS: Sulla chiavetta c'è davvero scritto Wifi N?

Io ho preso quella cinese con scritto sopra AI.
Dai cinesi scrivono solo questo (quindi poche info):

One AT order
e.g: AT+SET=40270102030405
40 is stand for 0X40, which means physical frequency 
---- You can set 126 0X40MHZ on the basis of 2400MHZ
27 is stand for SETUP register, 
which is use for setting transmit frequency and transmit-receive Baud rate. 
01 02 03 04 05 is stand for 5 software physical address.

Da qui, ad esempio: http://www.ebay.it/itm/331349375666?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1439.l2649

Quindi ha registri settabili, ma manca un datasheet, purtroppo.

In origine quell'utente che dicevo al primo post, linkò questo, da ebay germania:
http://www.ebay.it/itm/USB-wireless-serial-port-NRF24L01P-Communication-Compatible-CP06019-/281460518680?pt=Wissenschaftliche_Geräte&hash=item41885aaf18
Ma nella descrizione dice ancora meno e il link alla fine è zip del cinese con info in cinese.

I driver windows forniti nello zip cinese, hanno versione 32 e 64 bit.
In file RFCOM.inf a 32 bit, almeno su XP, ho dovuto modificare:

COMPANY="ÉîÛÚÊа²ÐſɿƼ¼"
MFGNAME="2.4GÎÞÏßÊý¾Ý¿Ú"

Togliendo quei caratteri penso unicode al cinese, ho messo

COMPANY=AITHINKER
MFGNAME="2.4GNRF"

E così funziona

Il registro SETUP sarà RF_SETUP? Se si però perché ha il valore 0x27 visto che il primo bit è riservato e deve essere zero? Perchè dice che si può impostare la frequenza mentre è il registro RF_CH e non RF_SETUP negli nrf24?

Non è documentato, motivo per non comprarlo mi sa

In teoria il costruttore è AI-THINKER, se ne parla nel thread di ESP8266, ma io il sito cinese di www.AI-THINKER.com non riesco a visualizzarlo, qualcuno invece riesce "spacciandosi" per olandese.
Magari li si trovano info. :disappointed_relieved:

Nel codice c'è scritto qualcosa di utile:

/wi-fi channel (frequency) and the address and the speed
  // those are the default values, can be modified by user
  //
  // To modify them send the following text to the terminal on which the 
usb dongle is: AT+SET=xxyyabcdefghij
  // xx is the channel
  // yy is the RF_SETUP REGISTER on nRF24l01 (on dongle there is BK2423, 
but works almost the same)
  //        It sets the dB power level and the speed (default value 0x07 
= 1Mhz, 0dB (maximum value));
  // ijghefcdab - the port (note that is in the reverse byte order)
  // all values are in hexadecimal
  // Example: to change to the default values use: AT+SET=28073443101001
  //

E qui altre info Chinesische USB/nRF24L01 Adpapter - Mikrocontroller.net

Però.. non mi ispira molto usare un clone.. meglio un device basato su un altro ic nordic.

Qualità costruttiva è pari a zero, guarda le immagini nel forum tedesco che ho linkato!

flz47655:
Qualità costruttiva è pari a zero, guarda le immagini nel forum tedesco che ho linkato!

Dici meglio qualcosa del genere ? sembra ben fatto
http://www.ebay.it/itm/191385827763?ssPageName=STRK:MESINDXX:IT&_trksid=p3984.m1436.l2649

Il Crazyradio è sicuro più serio, l'unica grande pecca però è un case e la difficoltà di programmazione visto che usa un Soc. Mi sa che rimango con la mia soluzione (micro usb + nrf24l01+) visto che gli ho fatto pure un case, peccato che è venuto un pò più grosso di quello dei cinesi :slight_smile:

Foto ? ;D Son curioso ...

Cit. anche le ostrichette erano curiose..

OT: Hai PM