Modules radio ou autres pour portée et autonomie maximale

Bonjour!

Je te conseille aussi les NRF24, je les utilise avec succès et sur de bonnes distances. Pour autonomie, je te conseille des arduino pro mini 3v3, tu prends une pince et tu casse la led smd liée à la pin 13 tu gagneras déjà quelques ma. Tu peux aussi utiliser l'horloge interne avec un programmateur externe. Ensuite désactives tout ce qui ne t'es pas utile de manière logicielle(ADC..)...bref la bidouilla après ]:slight_smile: Perso j'arrive à une consommation de 32ua en mode veille.

Bonne chance!
Alex.

josse34:
Bonjour à tous!!

Je suis à la recherche de modules radio ou autres permettant une portée maximale à travers divers obstacles tout en gardant une excellente autonomie.

Mon projet serait de mettre un arduino en intérieur et un module déporté duquel je souhaite compter une impulsion et l'envoyer ce compte toutes les 10min à l'arduino. Ou alors d'envoyer un signal à chaque impulsion.

Avez vous des idées et conseils?

Grand merci et bonne journée!

B@tto:
Avec un sticker et un µC de plus :smiley:

Avec DEUX stickers, ça rigole pas chez Ti :grin:

alex72:
Bonjour!

Je te conseille aussi les NRF24, je les utilise avec succès et sur de bonnes distances. Pour autonomie, je te conseille des arduino pro mini 3v3, tu prends une pince et tu casse la led smd liée à la pin 13 tu gagneras déjà quelques ma. Tu peux aussi utiliser l'horloge interne avec un programmateur externe. Ensuite désactives tout ce qui ne t'es pas utile de manière logicielle(ADC..)...bref la bidouilla après ]:slight_smile: Perso j'arrive à une consommation de 32ua en mode veille.

Bonne chance!
Alex.

Salut!
J'avais la même idée que toi de casser la led, avec 32µA, cela fait une autonomie de prés de 5ans! http://oregonembedded.com/batterycalc.htm Pas mal du tout!

Je vais essayer, en attendant je viens de recevoir mon MSP430 Launchpad, c'est bien conçu et Energia est magnifique! Un véritable clone de l'arduino, c'est agréable!!!
J'ai essayé de suivre ce tuto pour l'utilisation avec NRF24L01 : [Tutorial] Le Nrf24L01, l’Arduino et le MSP 430. | B@ttoMicro - Microcontrôleurs et compagnie ! ainsi que la librairie : GitHub - spirilis/msprf24: nRF24L01+ Library for MSP430 microcontroller line :

#include <msp430.h>
#include "msprf24.h"
#include "nrf_userconfig.h"
 
char addrTX[]={'t','e','s','t','2'};
 
char buf[]={0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; // trame exemple
 
int main(void) {
 
WDTCTL = WDTPW + WDTHOLD;
BCSCTL2 = SELM_0 + DIVM_0 + DIVS_0;
 
if (CALBC1_1MHZ != 0xFF) {
DCOCTL = 0x00;
BCSCTL1 = CALBC1_1MHZ; /* Set DCO to 1MHz */
DCOCTL = CALDCO_1MHZ;
}
 
BCSCTL1 |= XT2OFF + DIVA_3;
BCSCTL3 = XT2S_0 + LFXT1S_0 + XCAP_0;
TA0CCTL0 = CM_0 + CCIS_0 + OUTMOD_0 + CCIE; // configuration du timer à 1 s
TA0CCR0 = 4095;
TA0CTL = TASSEL_1 + ID_0 + MC_1;
 
UCB0CTL1 |= UCSWRST; // configuration du SPI
UCB0CTL0 = UCMSB + UCMST + UCMODE_0 + UCSYNC;
UCB0CTL1 = UCSSEL_2 + UCSWRST;
UCB0BR0 = 64;
UCB0BR1 = 6;
UCB0CTL1 = ~UCSWRST;
 
P1DIR|=BIT0;
 
rf_crc=RF24_EN_CRC|RF24_CRCO; // CRC active, 16-bit
rf_addr_width=5; // On utilise une adresse de 5 bytes
rf_speed_power=RF24_SPEED_2MBPS|RF24_POWER_0DBM; // vitesse 1MBPS et puissance max
rf_channel=1;
 
msprf24_init();
 
msprf24_set_pipe_packetsize(0,16); // payload de 16 byte sur le pipe 0
msprf24_open_pipe(0,1); // ouverture du pipe avec Auto-Acknowledgement
 
w_tx_addr(addrTX); // configuration adresse émission
w_rx_addr(0,addrTX); // configuration adresse réception idem à celle de transmission
                      // pour permettre la réception de l'ACK
 
msprf24_standby(); // module en veille (pas endormi)
 
while(1){
 
if(msprf24_is_alive()) { // fait clignoter la LED rouge sur launchpad si
    P1OUT^=BIT0; // le nrf est bien connecté
}else{
    P1OUT&=!BIT0;
}
 
LPM3; // on endort
 
w_tx_payload(16,buf); // on charge le FIFO avec le tableau buf
msprf24_activate_tx(); // émission
msprf24_get_irq_reason(); // récupère les alertes du NRF
while(!(rf_irq && RF24_IRQ_TX)) msprf24_get_irq_reason(); // tant que la transmission n’est pas finie, on boucle
msprf24_irq_clear(RF24_IRQ_TX); // on efface les flags d’alerte
 
}
 
}
 
#pragma vector=TIMER0_A0_VECTOR
__interrupt void TIMER0_A0_ISR_H

Le fichier "nrf_userconfig.h" contient :

/* nrf_userconfig.h
 * User configuration of nRF24L01+ connectivity parameters, e.g.
 * IRQ, CSN, CE pin assignments, Serial SPI driver type
 *
 *
 * Copyright (c) 2012, Eric Brundick <spirilis@linux.com>
 *
 * Permission to use, copy, modify, and/or distribute this software for any purpose
 * with or without fee is hereby granted, provided that the above copyright notice
 * and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
 * FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT,
 * OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
 * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */

#ifndef _NRF_USERCONFIG_H
#define _NRF_USERCONFIG_H

/* CPU clock cycles for the specified amounts of time--accurate minimum delays
 * required for reliable operation of the nRF24L01+'s state machine.
 */
/* Settings for 1MHz MCLK.
#define DELAY_CYCLES_5MS       5000
#define DELAY_CYCLES_130US     130
#define DELAY_CYCLES_15US      15
 */

/* Settings for 8MHz MCLK.
#define DELAY_CYCLES_5MS       40000
#define DELAY_CYCLES_130US     1040
#define DELAY_CYCLES_15US      120
 */

/* Settings for 16MHz MCLK */
#define DELAY_CYCLES_5MS       80000
#define DELAY_CYCLES_130US     2080
#define DELAY_CYCLES_15US      240

/* Settings for 24MHz MCLK.
#define DELAY_CYCLES_5MS       120000
#define DELAY_CYCLES_130US     3120
#define DELAY_CYCLES_15US      360
 */

/* SPI port--Select which USCI port we're using.
 * Applies only to USCI devices.  USI users can keep these
 * commented out.
 */
//#define RF24_SPI_DRIVER_USCI_A 1
#define RF24_SPI_DRIVER_USCI_B 1

/* Define whether this library should use LPM0+IRQs during SPI I/O and whether this library should provide the ISR. */
#define RF24_SPI_DRIVER_USCI_USE_IRQ 1
#define RF24_SPI_DRIVER_USCI_PROVIDE_ISR 1


/* Operational pins -- IRQ, CE, CSN (SPI chip-select)
 */

/* IRQ */
#define nrfIRQport 2
#define nrfIRQpin BIT2

/* CSN SPI chip-select */
#define nrfCSNport 2
#define nrfCSNportout P2OUT
#define nrfCSNpin BIT1

/* CE Chip-Enable (used to put RF transceiver on-air for RX or TX) */
#define nrfCEport 2
#define nrfCEportout P2OUT
#define nrfCEpin BIT0

#endif

Dans le tuto il indique :

Modification du nrf_userconfig.h : en haut il y des constantes suivant la fréquence de fonctionnement, il suffit de décommenter la partie qui vous correspond et de commenter les autres et en bas la partie hardware pour définir où sont brancher les pins CE, CSN et IRQ si vous l’utilisez

Je ne sais pas à quelle pin physique correspond les BIT0, BIT1 et BIT2 pour regler en fonction du pinage que j'utilise :

P1.5: SCK
P1.6: MISO
P1.7: MOSi
P2.0: CE
P2.1: CSN
P2.2: IRQ

Je recontre une erreur de compilation :

sketch_jul18a.cpp.o: In function main': C:\Users\acer\AppData\Local\Temp\build4513026607041527577.tmp/sketch_jul18a.cpp:40: undefined reference to msprf24_init()'
C:\Users\acer\AppData\Local\Temp\build4513026607041527577.tmp/sketch_jul18a.cpp:42: undefined reference to msprf24_set_pipe_packetsize(unsigned char, unsigned char)' C:\Users\acer\AppData\Local\Temp\build4513026607041527577.tmp/sketch_jul18a.cpp:43: undefined reference to msprf24_open_pipe(unsigned char, unsigned char)'
C:\Users\acer\AppData\Local\Temp\build4513026607041527577.tmp/sketch_jul18a.cpp:45: undefined reference to w_tx_addr(char*)' C:\Users\acer\AppData\Local\Temp\build4513026607041527577.tmp/sketch_jul18a.cpp:46: undefined reference to w_rx_addr(unsigned char, char*)'
C:\Users\acer\AppData\Local\Temp\build4513026607041527577.tmp/sketch_jul18a.cpp:49: undefined reference to msprf24_standby()' C:\Users\acer\AppData\Local\Temp\build4513026607041527577.tmp/sketch_jul18a.cpp:53: undefined reference to msprf24_is_alive()'
C:\Users\acer\AppData\Local\Temp\build4513026607041527577.tmp/sketch_jul18a.cpp:61: undefined reference to w_tx_payload(unsigned char, char*)' C:\Users\acer\AppData\Local\Temp\build4513026607041527577.tmp/sketch_jul18a.cpp:62: undefined reference to msprf24_activate_tx()'
C:\Users\acer\AppData\Local\Temp\build4513026607041527577.tmp/sketch_jul18a.cpp:63: undefined reference to msprf24_get_irq_reason()' C:\Users\acer\AppData\Local\Temp\build4513026607041527577.tmp/sketch_jul18a.cpp:64: undefined reference to msprf24_get_irq_reason()'
C:\Users\acer\AppData\Local\Temp\build4513026607041527577.tmp/sketch_jul18a.cpp:65: undefined reference to `msprf24_irq_clear(unsigned char)'
collect2: ld returned 1 exit status

Merci et bonne journée!!!

C'est un tuto pour CCS, pas pour Energia :wink:

Il faudrait faire quelques modifications pour que la lib soit correctement intégrée.

Pour Energia il y a une toute prête : Connecting MSP430 and Stellaris Launchpad through NRF24L01 | Unbox & Beyond

Hey!

Salut!
J'avais la même idée que toi de casser la led, avec 32µA, cela fait une autonomie de prés de 5ans! http://oregonembedded.com/batterycalc.htm Pas mal du tout!

Oui c'est impressionnant, après il faut voir aussi ta consommation en mode normale et le temps d'utilisation dans ce mode...mais globalement on peut économiser beaucoup! :slight_smile:

Je vais essayer, en attendant je viens de recevoir mon MSP430 Launchpad, c'est bien conçu et Energia est magnifique! Un véritable clone de l'arduino, c'est agréable!!!

Je ne connais pas 'Energia' mais du coup tu éveilles ma curiosité et pour cela je t'en remercies! :wink:

J'ai essayé de suivre ce tuto pour l'utilisation avec NRF24L01 : [Tutorial] Le Nrf24L01, l’Arduino et le MSP 430. | B@ttoMicro - Microcontrôleurs et compagnie ! ainsi que la librairie : GitHub - spirilis/msprf24: nRF24L01+ Library for MSP430 microcontroller line :

Je ne connaissais pas cette librairie, du coup je ne pourrais pas t'aider sur ton problème de connections. Par contre, je ne saurais mieux te conseiller que d'utiliser la librairie disponible sur ce blog:

En fouinant, tu y trouveras une tonne de choses intéressantes sur notamment la réduction de consommation, la possibilité de créer une véritable réseau de nœuds NRF24L01 ...bref, je l'utilise et en suis entièrement satisfait. A toi de voir, je ne connais pas tes contraintes...

A bientôt!
Alex.

Bonjour!
Merci B@tto, le code et la librairie pour MSP430 de Connecting MSP430 and Stellaris Launchpad through NRF24L01 | Unbox & Beyond semble coller mais utilisée sans autre NRF24 les sketch exemple TX ou RX n'écrivent absolument rien sur la console.

Par contre sur l'ARDUINO comment adapter l'exemple GettingStarted montrée ci-dessous de la librairie d'une IBOARD PRO sur base MEGA légèrement dérivée de la librairie Getting Started with nRF24L01+ on Arduino | maniacbug pour communiquer avec le sketch exemple (RX ou TX) du MSP430?

/*
 Copyright (C) 2011 J. Coliz <maniacbug@ymail.com>
 Modified by Andy Karpov <andy.karpov@gmail.com>

 This program is free software; you can redistribute it and/or
 modify it under the terms of the GNU General Public License
 version 2 as published by the Free Software Foundation.
 */

/**
 * Example for Getting Started with nRF24L01+ radios. 
 *
 * This is an example of how to use the RF24 class.  Write this sketch to two 
 * different nodes.  Put one of the nodes into 'transmit' mode by connecting 
 * with the serial monitor and sending a 'T'.  The ping node sends the current 
 * time to the pong node, which responds by sending the value back.  The ping 
 * node can then see how long the whole cycle took.
 */

#include <SPI.h>
#include <digitalWriteFast.h>
#include "iBoardRF24.h"
#include "printf.h"

//
// Hardware configuration
//

// Set up nRF24L01 radio on iBoard
iBoardRF24 radio(12,11,8,7,9,2);

//
// Topology
//

// Radio pipe addresses for the 2 nodes to communicate.
const uint64_t pipes[2] = { 0xF0F0F0F0E1LL, 0xF0F0F0F0D2LL };

//
// Role management
//
// Set up role.  This sketch uses the same software for all the nodes
// in this system.  Doing so greatly simplifies testing.  
//

// The various roles supported by this sketch
typedef enum { role_ping_out = 1, role_pong_back } role_e;

// The debug-friendly names of those roles
const char* role_friendly_name[] = { "invalid", "Ping out", "Pong back"};

// The role of the current running sketch
role_e role = role_pong_back;

void setup(void)
{
  //
  // Print preamble
  //

  Serial.begin(57600);
  printf_begin();
  printf("\n\rRF24/examples/GettingStarted/\n\r");
  printf("ROLE: %s\n\r",role_friendly_name[role]);
  printf("*** PRESS 'T' to begin transmitting to the other node\n\r");

  //
  // Setup and configure rf radio
  //

  radio.begin();

  // optionally, increase the delay between retries & # of retries
  radio.setRetries(15,15);

  // optionally, reduce the payload size.  seems to
  // improve reliability
  radio.setPayloadSize(8);

  //
  // Open pipes to other nodes for communication
  //

  // This simple sketch opens two pipes for these two nodes to communicate
  // back and forth.
  // Open 'our' pipe for writing
  // Open the 'other' pipe for reading, in position #1 (we can have up to 5 pipes open for reading)

  if ( role == role_ping_out )
  {
    radio.openWritingPipe(pipes[0]);
    radio.openReadingPipe(1,pipes[1]);
  }
  else
  {
    radio.openWritingPipe(pipes[1]);
    radio.openReadingPipe(1,pipes[0]);
  }

  //
  // Start listening
  //

  radio.startListening();

  //
  // Dump the configuration of the rf unit for debugging
  //

  radio.printDetails();
}

void loop(void)
{
  //
  // Ping out role.  Repeatedly send the current time
  //

  if (role == role_ping_out)
  {
    // First, stop listening so we can talk.
    radio.stopListening();

    // Take the time, and send it.  This will block until complete
    unsigned long time = millis();
    printf("Now sending %lu...",time);
    bool ok = radio.write( &time, sizeof(unsigned long) );
    
    if (ok)
      printf("ok...");
    else
      printf("failed.\n\r");

    // Now, continue listening
    radio.startListening();

    // Wait here until we get a response, or timeout (250ms)
    unsigned long started_waiting_at = millis();
    bool timeout = false;
    while ( ! radio.available() && ! timeout )
      if (millis() - started_waiting_at > 200 )
        timeout = true;

    // Describe the results
    if ( timeout )
    {
      printf("Failed, response timed out.\n\r");
    }
    else
    {
      // Grab the response, compare, and send to debugging spew
      unsigned long got_time;
      radio.read( &got_time, sizeof(unsigned long) );

      // Spew it
      printf("Got response %lu, round-trip delay: %lu\n\r",got_time,millis()-got_time);
    }

    // Try again 1s later
    delay(1000);
  }

  //
  // Pong back role.  Receive each packet, dump it out, and send it back
  //

  if ( role == role_pong_back )
  {
    // if there is data ready
    if ( radio.available() )
    {
      // Dump the payloads until we've gotten everything
      unsigned long got_time;
      bool done = false;
      while (!done)
      {
        // Fetch the payload, and see if this was the last one.
        done = radio.read( &got_time, sizeof(unsigned long) );

        // Spew it
        printf("Got payload %lu...",got_time);

	// Delay just a little bit to let the other unit
	// make the transition to receiver
	delay(20);
      }

      // First, stop listening so we can talk
      radio.stopListening();

      // Send the final one back.
      radio.write( &got_time, sizeof(unsigned long) );
      printf("Sent response.\n\r");

      // Now, resume listening so we catch the next packets.
      radio.startListening();
    }
  }

  //
  // Change roles
  //

  if ( Serial.available() )
  {
    char c = toupper(Serial.read());
    if ( c == 'T' && role == role_pong_back )
    {
      printf("*** CHANGING TO TRANSMIT ROLE -- PRESS 'R' TO SWITCH BACK\n\r");

      // Become the primary transmitter (ping out)
      role = role_ping_out;
      radio.openWritingPipe(pipes[0]);
      radio.openReadingPipe(1,pipes[1]);
    }
    else if ( c == 'R' && role == role_ping_out )
    {
      printf("*** CHANGING TO RECEIVE ROLE -- PRESS 'T' TO SWITCH BACK\n\r");
      
      // Become the primary receiver (pong back)
      role = role_pong_back;
      radio.openWritingPipe(pipes[1]);
      radio.openReadingPipe(1,pipes[0]);
    }
  }
}
// vim:cin:ai:sts=2 sw=2 ft=cpp

Merci!