DevDuino v2.2 with EEPROM
-
Hi,
Are there anybody, who could use the RF on this board with mySensors?
http://www.seeedstudio.com/wiki/DevDuino_Sensor_Node_V2.2_(ATmega_328)I ordered one from this board and yesterday received. Firstly I couldn't upload sketch, but I found out the RX and TX pin label swapped on the board. After it, I could upload a sketch from here:
https://codebender.cc/sketch:54782?referrer=greglBut the CE and CS pins moved to 7 and 6 (I changed it in the sketch) . But after boot, I got radio fail error on serial port.
-
@icebob Where did you change the CE and CS pin designations?
-
@Dwalt I'm using v1.5 so I added CE, CS define lines below MySensors.h include line
-
Ok, now it's working. I changed CE and CS in MyConfig.h. I thought I can redefine the values in the sketch file too.
-
Nope #defines doesn't get propagated from the sketch in 1.5.
But you will be able to do it from codebender once we release the 1.6 version of the library [but we had to do some haxxor thing to get that working].
-
@hek Thanks. I'm waiting for 1.6.
-
Try it this way
#include <SPI.h>
#include <MySensor.h>
#include <MyTransportNRF24.h>
#include <Vcc.h>const float VccMin = 2.00.6; // Minimum expected Vcc level, in Volts. Example for 2xAA Alkaline.
const float VccMax = 2.01.5; // Maximum expected Vcc level, in Volts. Example for 2xAA Alkaline.
const float VccCorrection = 3.07/3.04; // Measured Vcc by multimeter divided by reported VccVcc vcc(VccCorrection);
int TEMP_SENSE_PIN = A3; // select the input pin for the battery sense point
float TEMP_SENSE_OFFSET = -0.01;#define CHILD_ID_TEMP 0
//MySensor gw (8,7);
MyTransportNRF24 transport(7, 6);
MySensor gw(transport);
-
@Oleg-Greengo thank you! It's working!
I modified the code and it's working on DevDuino v2.2
https://codebender.cc/sketch:203114
-
The power comsumption is 30uA in sleep (not connected additional sensor just the MCP9700).
-
Here is the code works with devDuino v2.2
It shows how all of the sensors on board (via com port)
and also makes it possible to (expect) to download the firmware over the air. (for example through MYSController)/* This sketch is for a devDuino SN v2.2 with the support OTA http://www.seeedstudio.com/wiki/DevDuino_Sensor_Node_V2.2_(ATmega_328) and MySensors 1.5 For testing all the equipment, press the button D4 when a voltage is applied. This sketch is a modification of code written Version 1.3 - Thomas Bowman Mørch for sensor Sensebender Micro http://www.mysensors.org/hardware/micro modified 18 December 2015 by greengo */ #include <MySensor.h> #include <SPI.h> #include "utility/SPIFlash.h" #include <EEPROM.h> #include <sha204_lib_return_codes.h> #include <sha204_library.h> // Define a static node address, remove if you want auto address assignment //#define NODE_ADDRESS 2 #define RELEASE "0.01" #define TEST_PIN 4 // Button D4 #define TEMP_SENSE_PIN A3 // Input pin for the Temp sensor MCP9700 #define LED_PIN 9 // LED #define ATSHA204_PIN A2 // ATSHA204A const int sha204Pin = ATSHA204_PIN; atsha204Class sha204(sha204Pin); SPIFlash flash(8, 0x1F65); MyTransportNRF24 transport(7, 6); MySensor gw(transport); // the setup function runs once when you press reset or power the board void setup() { // initialize digital pin 9 as an output. pinMode(LED_PIN, OUTPUT); Serial.begin(115200); Serial.print(F("devDuino V2.2")); Serial.println(RELEASE); Serial.flush(); // First check if we should boot into test mode pinMode(TEST_PIN,INPUT); digitalWrite(TEST_PIN, HIGH); // Enable pullup if (!digitalRead(TEST_PIN)) testMode(); // Make sure that ATSHA204 is not floating pinMode(ATSHA204_PIN, INPUT); digitalWrite(ATSHA204_PIN, HIGH); digitalWrite(LED_PIN, HIGH); #ifdef NODE_ADDRESS gw.begin(NULL, NODE_ADDRESS, false); #else gw.begin(NULL,AUTO,false); #endif digitalWrite(LED_PIN, LOW); Serial.flush(); Serial.println(F(" - Online!")); gw.sendSketchInfo("devDuino SN V2.2", RELEASE); } // the loop function runs over and over again forever void loop() { gw.process(); } /**************************************************** * * Verify all peripherals, and signal via the LED if any problems. * ****************************************************/ void testMode() { uint8_t rx_buffer[SHA204_RSP_SIZE_MAX]; uint8_t ret_code; byte tests = 0; digitalWrite(LED_PIN, HIGH); // Turn on LED. Serial.println(F(" - TestMode")); Serial.println(F("Testing peripherals!")); Serial.flush(); Serial.print(F("-> MCP9700 : ")); Serial.flush(); if (analogRead (TEMP_SENSE_PIN),HIGH ) { Serial.println(F("ok!")); tests ++; } else { Serial.println(F("failed!")); } Serial.flush(); Serial.print(F("-> Flash : ")); Serial.flush(); if (flash.initialize()) { Serial.println(F("ok!")); tests ++; } else { Serial.println(F("failed!")); } Serial.flush(); Serial.print(F("-> SHA204 : ")); ret_code = sha204.sha204c_wakeup(rx_buffer); Serial.flush(); if (ret_code != SHA204_SUCCESS) { Serial.print(F("Failed to wake device. Response: ")); Serial.println(ret_code, HEX); } Serial.flush(); if (ret_code == SHA204_SUCCESS) { ret_code = sha204.getSerialNumber(rx_buffer); if (ret_code != SHA204_SUCCESS) { Serial.print(F("Failed to obtain device serial number. Response: ")); Serial.println(ret_code, HEX); } else { Serial.print(F("Ok (serial : ")); for (int i=0; i<9; i++) { if (rx_buffer[i] < 0x10) { Serial.print('0'); // Because Serial.print does not 0-pad HEX } Serial.print(rx_buffer[i], HEX); } Serial.println(")"); tests ++; } } Serial.flush(); Serial.println(F("Test finished")); if (tests == 3) { Serial.println(F("Selftest ok!")); while (1) // Blink OK pattern! { digitalWrite(LED_PIN, HIGH); delay(200); digitalWrite(LED_PIN, LOW); delay(200); } } else { Serial.println(F("----> Selftest failed!")); while (1) // Blink FAILED pattern! Rappidly blinking.. { } } }