Giter Site home page Giter Site logo

marvin's People

Contributors

dirkvl avatar jeroenbeemster avatar michieljol avatar piair avatar stamhuis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

marvin's Issues

Seeed GPS Grove Module v1.2 and Marvin

Hi,

I am trying to use this module on the 3rd Marvin Grove Port (Marked D12 and D4 on the bottom of the PCB) in conjunction with the SoftwareSerial library. Here is the start of the sketch. It does not work - SoftSerial.available() always return 0. I have tried swapping the 12,4 around just in case I had RX/TX swapped. In looking at the schematics I am wondering whether that Grove port is really Digital 12 and Digital 4 ?? (seems to suggest D1 and D2).

Assuming I can get the ports right, should this actually work? I cannot see why not!

If I need to use the broken out RX/TX pads on the PCB .. what is the code I need?

Thanks!!

Pat

#include <SoftwareSerial.h>
SoftwareSerial SoftSerial(12,4);            // RX, TX
unsigned char buffer[64];                   // buffer array for data receive over serial port
int count=0;                                // counter for buffer array
void setup()
{
    SoftSerial.begin(9600);                 // the SoftSerial baud rate
    Serial.begin(9600);                     // the Serial port of Arduino baud rate.
    
}

void loop()
{
    Serial.print("Hello --- ");
    Serial.println(SoftSerial.available());
    if (SoftSerial.available())                     // if data is coming from software serial port ==> data is coming from SoftSerial shield

Low power mode

Can't get the low power mode from the atmega in combination with the RN2483 to work.

I want to create a sampling application which samples at a frequency of 15 minutes.
For this we put the atmega to sleep which works but combined with the RN2483 sys sleep ...... gives hangup's.

What is the correct way to use as little of power possible (SLEEP_MODE_IDLE) in combination with the RN2482 sys sleep command. Now i created a watchdog timer to wakeup again.

ISR(WDT_vect)
{
sleep_count ++; // keep track of how many sleep cycles
// have been completed.
if (sleep_count == sleep_total)
Wakeup();
}

in loop i test that Wakeup has set the volatile int to do action and then sample the data send it and got to sleep again. Any help is welcome ๐Ÿ‘

Marvin LoRa stops after first loop when code WaterFlowSensor is changed with code TemperatureSensor

Hi Githubbers,

Today I tried to connect Marvin LoRa device with The Things Network, fortunaly with basic program from https://github.com/iotacademy/marvin/blob/master/Software/MarvinBase/MarvinBase.ino allows me to connect to The Things Network (Keys are changed to the ones I use with TTN).

After I changed the code with temperature sensor to waterflow sensor the code stops running after the first loop. The first reading is send to TTN, but not the following readings because the loop got stuck.

Waterflow sensor is YF-402.
The port used is farthest from the Marvin LoRa USB.
Program: Arduino
Board: Arduino Leonardo

Can you guys explain what has happened to the loops?
The code I use is as follows:

/*
MarvinBase

Basic controls of IoT Academy Marvin LoRa Development board.

This version supports:

Sending LoRa uplink messages using ABP
Blink three times when sending data
Power control to RN2483 module
Instructions:

Get the latest version of the Arduino software
In Arduino IDE select Arduino Leonardo and com port of your device
Please adjust ABP adresses and key below to match yours
The loop() is where the actual stuff happens. Adjust input of send_lora_data() in void loop() to send your own data.
*/
/// #include <CayenneLPP.h> //App integratie

/// CayenneLPP lpp(51); //Buffergrootte in bytes

// Port to assign the type of lora data (any port can be used between 1 and 223)
int set_port = 1;

// Some standard ports that depend on the layout of the Marvin
long defaultBaudRate = 57600;
int reset_port = 5;
int RN2483_power_port = 6; //Note that an earlier version of the Marvin doesn't support seperate power to RN2483
int led_port = 13;

int flowPin = 39; //This is the input pin on the Arduino
float flowRate; //This is the value we intend to calculate.
volatile float count; //This integer needs to be set as volatile to ensure it updates correctly during the interrupt process.

//*** Set parameters here BEGIN ---->
String set_nwkskey = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; // Make sure you use your keys from TTN here
String set_appskey = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
String set_devaddr = "XXXXXXXX";
//*** <---- END Set parameters here

/*

Setup() function is called when board is started. Marvin uses a serial connection to talk to your pc and a serial

connection to talk to the RN2483, these are both initialized in seperate functions. Also some Arduino port are

initialized and a LED is called to blink when everything is done.
*/
void setup() {
Serial.begin(defaultBaudRate);
Serial1.begin(defaultBaudRate);
InitializeSerials(defaultBaudRate);
initializeRN2483(RN2483_power_port, reset_port);
pinMode(led_port, OUTPUT); // Initialize LED port
blinky();

pinMode(flowPin, INPUT); //Sets the pin as an input
attachInterrupt(0, Flow, RISING); //Configures interrupt 0 (pin 2 on the Arduino Uno) to run the function "Flow"
Serial.begin(9600); //Start Serial
}

void loop() {

count = 0; // Reset the counter so we start counting from 0 again
interrupts(); //Enables interrupts on the Arduino
delay (1000); //Wait 1 second
noInterrupts(); //Disable the interrupts on the Arduino

//Start the math
flowRate = (count / 4.380); //Take counted pulses in the last second and multiply by 98
flowRate = flowRate * 60; //Convert seconds to minutes, giving you mL / Minute

flowRate = flowRate + 0.5;
int mL_min = (int)flowRate;

Serial.println(mL_min);

delay(100);
send_LoRa_data(set_port, String(mL_min));
blinky();
delay(1000);
read_data_from_LoRa_Mod();
delay(3000);
}

void Flow()
{
count++; //Every time this function is called, increment "count" by 1
}

void InitializeSerials(int baudrate)
{
delay(1000);
print_to_console("Serial ports initialised");
}

void initializeRN2483(int pwr_port, int rst_port)
{
//Enable power to the RN2483
pinMode(pwr_port, OUTPUT);
digitalWrite(pwr_port, HIGH);
print_to_console("RN2483 Powered up");
delay(1000);

//Disable reset pin
pinMode(rst_port, OUTPUT);
digitalWrite(rst_port, HIGH);

//Configure LoRa module
send_LoRa_Command("sys reset");
read_data_from_LoRa_Mod();

send_LoRa_Command("radio set crc off");
delay(1000);
read_data_from_LoRa_Mod();

send_LoRa_Command("mac set nwkskey " + set_nwkskey);
read_data_from_LoRa_Mod();

send_LoRa_Command("mac set appskey " + set_appskey);
read_data_from_LoRa_Mod();

send_LoRa_Command("mac set devaddr " + set_devaddr);
read_data_from_LoRa_Mod();

//For this commands some extra delay is needed.
/// send_LoRa_Command("mac set adr on");
/// delay(1000);
/// read_data_from_LoRa_Mod();

send_LoRa_Command("mac save");
delay(1000);
read_data_from_LoRa_Mod();

send_LoRa_Command("mac join abp");
delay(1000);
read_data_from_LoRa_Mod();

}

void print_to_console(String message)
{
Serial.println(message);
}

void read_data_from_LoRa_Mod()
{
if (Serial1.available()) {
String inByte = Serial1.readString();
Serial.println(inByte);
}

}

void send_LoRa_Command(String cmd)
{
print_to_console("Now sending: " + cmd);
Serial1.println(cmd);
delay(500);
}

void send_LoRa_data(int tx_port, String rawdata)
{
send_LoRa_Command("mac tx uncnf " + String(tx_port) + String(" ") + rawdata);
}

void blinky()
{
digitalWrite(led_port, HIGH); // turn the LED on (HIGH is the voltage level)
delay(500); // wait for a second
digitalWrite(led_port, LOW); // turn the LED off by making the voltage LOW
delay(500); // wait for a second
digitalWrite(led_port, HIGH); // turn the LED on (HIGH is the voltage level)
delay(500); // wait for a second
digitalWrite(led_port, LOW); // turn the LED off by making the voltage LOW
delay(500); // wait for a second

}

LoRa Arduino UNO

Hi, I would just like to modify Temperature and humidity sketch in order to be able to use it by Arduino 'UNO' Board and LoRa module, rather than 'Mega' one. Since I saw Serial1 port communication is used on this code. So, my question is;

  • Which steps should I take in order to modify the code for the purpose I comment above?

Many thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.