SolarRC

From SGMK-SSAM-WIKI
Revision as of 20:28, 6 May 2015 by 0rel (talk | contribs) (→‎TODO)
Jump to navigation Jump to search

Description

A quite inexpensive and simple solar powered AVR ATtiny circuit to collect data from the environment.


Overview

We've tested the following hardware:


In combination with:

  • 2x Arduinos (on the same computer, good for debugging via serial monitor - just start the arduino IDE twice)
  • 2x ATtiny85 (great for final devices, placed somwhere outside)


Software: Those two Arduino libraries were tested successfully:


Tests showed that it is possible to transmit data reliably indoor up to a distance of about 20 meters. The signal gets weaker, depending on the obstacles between sender/receiver of course. To improve the signal quality it was helpful to use a simple wire on stick of 17.3cm in length (quarter wavelength) as an antenna on both, sender/receiver modules.

TODO

  • Measure power consumption and average solar charging rate... is it possible to run the device non-stop, also during the night, collecting data?
  • Investigate more about low power usage/sleep mode... and energy harvesting in general.
  • What's the minimal number of parts/price needed to shrinkify the the whole setup to a single board? (3.3 V?)
  • Mesh network with receiver/transmitter pair (transceiver) on every node? Can the nodes be used as "relays" to increase transmission range? What kind of protcol is ideal for this? How to minimize collisions/corrupted data (send checksum)? Does it make sense ($$$) compared to XBee, BLE, WiFi etc.?
  • It is possible make a very simple radio transmitter, by using just the internal oscillator of the microcontroller! Have a look at this great hack by Scott W Harden. To receive the data, a diode detector could be used to demodulate the AM signal and read it in again on an analog pin... but this is just fantasy, no clue if/how/how good this will work, we'll see...

Setup

Transmitter setup:


Sender and receiver module:

Code

Transmitter

/*

  Manchester Receiver example
  
  In this example transmitter will transmit two 8 bit numbers per transmittion
    
*/


#include "ManchesterRF.h" //https://github.com/cano64/ManchesterRF


#define TX_PIN 3 //any pin can transmit
#define LED_PIN 13

ManchesterRF rf(MAN_300); //link speed, try also MAN_300, MAN_600, MAN_1200, MAN_2400, MAN_4800, MAN_9600, MAN_19200, MAN_38400

uint8_t data = 0;

boolean state = false;

void setup() {
  pinMode(LED_PIN, OUTPUT);  
  digitalWrite(LED_PIN, HIGH);
  rf.TXInit(TX_PIN);
  
  Serial.begin( 9600 );
}

void loop() {

  int a, b;
  rf.transmitByte(a = ++data, b = data*data);
  digitalWrite(LED_PIN, state); //blink the LED on receive
  state = !state;
  
  Serial.print( a );
  Serial.print( ", " );
  Serial.print( b );
  Serial.println();
  delay(500);
}


Receiver

/*

  Manchester Receiver example
  
  In this example receiver will receive two 8 bit numbers per transmittion

*/


#include "ManchesterRF.h" //https://github.com/cano64/ManchesterRF

#define RX_PIN 4 //any pin can receive
#define LED_PIN 13

ManchesterRF rf(MAN_300); //link speed, try also MAN_300, MAN_600, MAN_1200, MAN_2400, MAN_4800, MAN_9600, MAN_19200, MAN_38400

uint8_t a, b;

boolean state = false;

void setup() {
  pinMode(LED_PIN, OUTPUT);  
  digitalWrite(LED_PIN, HIGH);
  rf.RXInit(RX_PIN);
  
  Serial.begin( 9600 );
}

void loop() {

  if (rf.available()) { //something is in RX buffer
    if (rf.receiveByte(a, b)) {
      //process the data
      //...
      digitalWrite(LED_PIN, state); //blink the LED on receive
      state = !state;
      
      Serial.print( a );
      Serial.print( ", " );
      Serial.print( b );
      Serial.println();
    }
  }
}