Show Posts
Pages: [1] 2
1  Using Arduino / Sensors / Re: analog voltage not 0V when digital pin connected to analog pin set to LOW on: August 10, 2014, 07:33:52 am
Thanks for your support JimboZA
2  Using Arduino / Sensors / Re: analog voltage not 0V when digital pin connected to analog pin set to LOW on: August 10, 2014, 07:28:53 am
Yes.  I have checked my code more than once and I obviously read what should be there rather than what is there.
3  Using Arduino / Sensors / Re: analog voltage not 0V when digital pin connected to analog pin set to LOW on: August 10, 2014, 07:14:55 am
I have just noticed that not all the digital pins had the corresponding PINMODE set.  When I corrected this mistake everything seemed to work correctly.
4  Using Arduino / Sensors / Re: analog voltage not 0V when digital pin connected to analog pin set to LOW on: August 10, 2014, 07:03:30 am
 Serial.begin(57600);
  pinMode(2, OUTPUT); pinMode(3, OUTPUT); pinMode(3, OUTPUT); pinMode(3, OUTPUT);
   digitalWrite(2,HIGH); digitalWrite(3,HIGH); digitalWrite(4,LOW); digitalWrite(5,HIGH);
 ......

float temperature_measurement(int pin)
{
 // analogReference(INTERNAL);
  float Temperature = 0;
  float avtempRead  = 0;
  for (int i = 1 ; i< 101 ; i++ ){
    delay (20);
   avtempRead   +=  analogRead(pin)*(5000.00/1024.00) ;
   //  avtempRead   +=  analogRead(pin);
  }
  Temperature = avtempRead / 100000.00 ; 
  return Temperature;
}
//*****************************************************************

void loop(void)
{
 
  float temperature2; float temperature3; float temperature4; float temperature5;
 
 
  temperature2 = temperature_measurement(A2); temperature3 = temperature_measurement(A3); temperature4 = temperature_measurement(A4); temperature5 = temperature_measurement(A5);
 
5  Using Arduino / Sensors / analog voltage not 0V when digital pin connected to analog pin set to LOW on: August 10, 2014, 06:44:34 am
Hi
I am exploring the ADC pins on a Nano board.  I have connected 4 digital pins to 4 analog pins.  On setting digital write to LOW I get about 3V reading.  Why do I not get 0V.  I have checked and there is 0 ohms between the two ground pins and the outer casing of the USB supply.  I get no difference in reading if I swap the supply from laptop to 5V wall socket supply.  Any help would be appreciated
6  Using Arduino / Programming Questions / Re: serial monitor print width on: February 12, 2014, 05:10:50 pm
Thanks.  I thought the short line length was a limitation of the IDE but it was a limitation of the programmer.  I have modified the sketch and it works as I  need
7  Using Arduino / Programming Questions / Re: serial monitor print width on: February 12, 2014, 12:57:57 pm
#include <RF24Network.h>
#include <RF24.h>
#include <SPI.h>

// nRF24L01(+) radio attached using Getting Started board
RF24 radio(9,10);

// Network uses that radio
RF24Network network(radio);

// Address of our node
const uint16_t this_node = 0;

// Address of the other node
const uint16_t other_node = 1;

// Structure of our payload
struct payload_t
{
  unsigned long ms;
  float counter;
  float room_temperature;
  float humidity;
  float counter1;
  float room_temperature1;
  float humidity1;
  float humidity2;

};
// ***************************************************************
float temperature_measurement(int pin)
{
  analogReference(INTERNAL);
  float Temperature = 0;
  float avtempRead  = 0;
  for (int i = 1 ; i< 101 ; i++ ){
    delay (10);
    avtempRead   +=  analogRead(pin)*(112000.00/1023.00/1.176) ;
  }
  Temperature = avtempRead / 100000.00 ; 
  return Temperature;
}
//*****************************************************************

void setup(void)
{
  Serial.begin(57600);
  Serial.println("RF24Network/examples/helloworld_rx_item_humidity/");
  SPI.begin();
  radio.begin();
  network.begin(/*channel*/ 90, /*node address*/ this_node);
  radio.printDetails();
}

void loop(void)
{

  // Pump the network regularly
  network.update();
  unsigned long ms;
  float counter;
  float room_temperature;
  float humidity;
  float counter1;
  float room_temperature1;
  float humidity1;
  float humidity2;

  // Is there anything ready for us?
  while ( network.available() )
  {
    // If so, grab it and print it out
    RF24NetworkHeader header;
    payload_t payload;
    network.read(header,&payload,sizeof(payload));

    (temperature_measurement(A1));
    Serial.print(millis()/5000);
    Serial.print(" ");
    Serial.print (counter,0);
    Serial.print(" ");
    Serial.print(temperature_measurement(A1),1);
    Serial.print(" ");
    Serial.print( payload.room_temperature,0);
    Serial.print(" ");
    Serial.println(payload.humidity1,0);
    Serial.print(" ");
    Serial.print (counter,0);
    Serial.print(" ");
    Serial.print(temperature_measurement(A2),1);
    Serial.print(" ");
    Serial.println( payload.room_temperature1,0);

   
  }
}

Here is the whole programme.  I don't understand why when I declare the names in the payload structure I have to re declare it.  So rather than find out I put it where it now is and it worked.  I should add I generated names for the data  as a trial as currently I am only reading 4 sensors..
All I want is the data to appear in a single line rather than 2 lines.  If I change the last print from println to print the data will be in continuous line and I will have to add line breaks myself.
8  Using Arduino / Programming Questions / Re: serial monitor print width on: February 12, 2014, 11:23:22 am
Code:
void setup(void)
{
  Serial.begin(57600);
  Serial.println("RF24Network/examples/helloworld_rx_item_humidity/");
  SPI.begin();
  radio.begin();
  network.begin(/*channel*/ 94, /*node address*/ this_node);
  radio.printDetails();
}

void loop(void)
{

  // Pump the network regularly
  network.update();
  unsigned long ms;
  float counter;
  float room_temperature;
  float humidity;
  float counter1;
  float room_temperature1;
  float humidity1;
  float humidity2;

  // Is there anything ready for us?
  while ( network.available() )
  {
    // If so, grab it and print it out
    RF24NetworkHeader header;
    payload_t payload;
    network.read(header,&payload,sizeof(payload));

    (temperature_measurement(A1));
    Serial.print(millis()/5000);
    Serial.print(" ");
    Serial.print (counter,0);
    Serial.print(" ");
    Serial.print(temperature_measurement(A1),1);
    Serial.print(" ");
    Serial.print( payload.room_temperature,0);
    Serial.print(" ");
    Serial.println(payload.humidity1,0);
    Serial.print(" ");
    Serial.print (counter,0);
    Serial.print(" ");
    Serial.print(temperature_measurement(A2),1);
    Serial.print(" ");
    Serial.println( payload.room_temperature1,0);
tags added by moderator - click "Modify" to see how it's done.
9  Using Arduino / Programming Questions / Re: serial monitor print width on: February 12, 2014, 10:57:59 am
I am data logging from a number of sensors and then graphing using Excel.  I need each line or chain of results to be a single line to make the graph straight forward.
10  Using Arduino / Programming Questions / serial monitor print width on: February 12, 2014, 09:31:04 am
Hi I am printing to the serial monitor up to 8 groups of numbers with 2 spaces as separators.  The numbers can have up to 4 digits plus a decimal point.  a max of 54 character spaces.  The result is always 2 lines  and I want 1 line.  How do I do this?  I am using Serial.print on the 1.0.5 IDE
11  Using Arduino / Programming Questions / initializer but incomplete type error on: January 09, 2014, 06:53:29 pm
I am using 1.0.5.  I have loaded a sketch which calls a number of library programmes   I have used a similar sketch which does not throw up errors.  The sketch is sensornet an NRF24 mesh program written by maniacbug.

 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 of a sensor network
 *
 * This sketch demonstrates how to use the RF24Network library to
 * manage a set of low-power sensor nodes which mostly sleep but
 * awake regularly to send readings to the base.
 *
 * The example uses TWO sensors, a 'temperature' sensor and a 'voltage'
 * sensor.
 *
 * To see the underlying frames being relayed, compile RF24Network with
 * #define SERIAL_DEBUG.
 *
 * The logical node address of each node is set in EEPROM.  The nodeconfig
 * module handles this by listening for a digit (0-9) on the serial port,
 * and writing that number to EEPROM.
 */

#include <avr/pgmspace.h>
#include <RF24Network.h>
#include <RF24.h>
#include <SPI.h>
#include <Tictocs.h>
#include <Button.h>
#include <TictocTimer.h>
#include "nodeconfig.h"
#include "sleep.h"
#include "S_message.h"
#include "printf.h"

// This is for git version tracking.  Safe to ignore
#ifdef VERSION_H
#include "version.h"
#else
#define __TAG__ "Unknown"
#endif

// Pin definitions
#ifndef PINS_DEFINED
#define __PLATFORM__ "Getting Started board"

// Pins for radio
const int rf_ce = 9;
const int rf_csn = 10;

// Pins for sensors
const int temp_pin = A2;
const int voltage_pin = A3;

// Pins for status LED, or '0' for no LED connected
const int led_red = 0;
const int led_yellow = 0;
const int led_green = 0;

// Button to control modes
const int button_a = 4;

// What voltage is a reading of 1023?
const unsigned voltage_reference = 5 * 256; // 5.0V
#endif


RF24Network network(radio);
This is the line which causes the error.

I cannot find any solutions to this problem  In truth I do not know what a initializer is and type is not explained in arduino reference.  Any help would be appreciated
12  Using Arduino / Networking, Protocols, and Devices / Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver on: January 04, 2014, 10:52:57 pm
Hi Guys.  I am having problems compiling Lord Maniacbug's sensornet sketch.  The problem seems to be in prinf.cpp  Where can I get an up to date copy.  It is very difficult for noobs  like me to figure out all the libraries when they are not listed on github.
On the positive side I have got 2 arduinos linked - one sending sensor data to the other.
Any help would be appreciated
13  Using Arduino / Programming Questions / Re: eeprom_update_block missing eeprom.h on: January 24, 2013, 03:39:19 pm
Thanks for your input guys.  I am really at sea here.  Help with a few lines of code to replace eeprom_update_block would be really handy.  I do not know if this is a big problem or not.
14  Using Arduino / Programming Questions / eeprom_update_block missing eeprom.h on: January 22, 2013, 11:41:31 am
It appears that the C++ instruction eeprom_update_block  is missing.  Does anybody have a work a round for this missing instruction
15  Using Arduino / Installation & Troubleshooting / Re: copying sketches to sd card on: November 26, 2012, 09:25:58 pm
I am not sure johnwasser.  I use ctrl C to copy highlighted text in the arduino IDE and then open a file and use ctrl V to copy the saved file and nothing happens.  Can you tell me what I am doing wrong as I use the same process on other text files?
Pages: [1] 2