Show Posts
Pages: 1 [2] 3 4 ... 15
16  Using Arduino / Programming Questions / Re: disassembling incoming serial data on: October 08, 2013, 06:35:42 am
I'm receiving the data and assembling it into a variable, and able to print that variable. Now I just need to parse the data into the individual variables and data. I'll post the code later. Lightning took out my phone and internet Sunday, and it should be back up later today.
17  Using Arduino / Programming Questions / Re: disassembling incoming serial data on: October 06, 2013, 08:13:02 am
Bob, The variable name is known in advance. John, you might want to try that code, it does not work.
18  Using Arduino / Programming Questions / disassembling incoming serial data on: October 06, 2013, 07:04:18 am
I have an Arduino that is sending a $, a character, then a numeric value, to another Arduino. That Arduino is displaying that data in the serial monitor, per the attached picture. I want to use the $ as an indicator that the next value is a variable name, and the value that follows is the value to put in that variable. A println indicates the end of the packet.

I need guidance on how to look for the $, and stuff the indicated variable with the value that follows.

TX Code
Code:
#include <SoftwareSerial.h>

SoftwareSerial mySerial(10, 11); // RX, TX

int value=0;

void setup() 
{
// set the data rate for the hardware serial port
  Serial.begin(9600);
// set the data rate for the SoftwareSerial port
  mySerial.begin(9600);
 
}

void loop() // run over and over
{
  Serial.print(value);
    uSend("L", value);
    uSend("M", value+5);
    value = value+1;
    delay(1000);
}


// Function to send serial data packet to other Aduino
 
  int uSend(char* x, int y){
   
  mySerial.print("$");
  mySerial.print(x);
  mySerial.println(y, DEC);
 
 
  }


RX Code
Code:
#include <SoftwareSerial.h>

SoftwareSerial mySerial(10, 11); // RX, TX

int value=0;

void setup() 
{
// set the data rate for the hardware serial port
  Serial.begin(9600);
// set the data rate for the SoftwareSerial port
  mySerial.begin(9600);
 
}

void loop() // run over and over
{
  if (mySerial.available())
    Serial.write(mySerial.read());
     
}
19  Community / Exhibition / Gallery / Simple Temperature Humidity Web Server on: October 02, 2013, 02:57:07 pm
Uno + Ethernet Shield + DHT-11 Temp/humidity sensor = monitor your home environment from anywhere!

Nothing fancy here, just the bare minimum. Set up NAT/DDNS on your home router, and you are in business. Monitor water sensors, security systems and more.

http://arduinotronics.blogspot.com/2013/09/arduino-temp-humidity-web-server.html
20  Community / Exhibition / Gallery / Text to Speech Temp/Humidity on TFT LCD on: September 29, 2013, 09:51:41 pm
This tutorial shows off a number of technologies, from using a TFT LCD, to outputting text to speech from a DHT-22 temp / humidity module - http://www.instructables.com/id/Temperature-and-Humidity-on-a-Graphical-LCD/
21  Community / Exhibition / Gallery / Smart Keyboard Interface on: September 29, 2013, 10:45:04 am
I needed to interface a PS/2 keyboard to my Arduino for a Radio Teletype application. The keyboard library takes up a bit of memory and cpu cycles, so I created a barebones arduino (about $10) to service the keyboard, and pass the resulting characters to the host arduino over serial. This works very well, and opens up the possibility of hacking the keyboard as a digital input device with hundreds of "sensors".

http://www.instructables.com/id/Creating-the-PS2-Keyboard-smart-interface-for-micr/

I'll be creating many more "Smart Sensors" with embedded Arduino's for preprocessing (coprocessing).
22  Using Arduino / Displays / Re: LCD vs relay problem on: July 17, 2013, 03:10:29 pm
My issue is that I'm testing commercial aquastats, and cannot swap out the relay's.
23  Using Arduino / Sensors / Re: Fluctuating analog output on: July 17, 2013, 11:36:48 am
do you have the ends of the slider connected to gnd and 5v respectively, and the wiper connected to the analog input? why not take a series of reading, and submit the average? Could be you have a defective wiper, or it sees a "floating input" ...
24  Using Arduino / Sensors / Load Cell / Scale on: July 17, 2013, 09:50:25 am
Using a cheap postal scale ($15) and a instrumental amplifier, You can make a nice digital scale / load cell for automating other processes. Improvements welcomed!

http://www.instructables.com/id/Arduino-Load-Cell-Scale/
25  Using Arduino / Displays / Re: advice needed for chosing a display for an embedded project on: July 17, 2013, 09:25:45 am
I'm having a lot of fun with the ST3775R from SainSmart. It's a 1.8 Color TFT, readable outdoors. See the project at http://arduinotronics.blogspot.com/2013/07/sainsmart-18-lcd-dht-22-temp-humidity.html
26  Using Arduino / Displays / Re: LCD vs relay problem on: July 17, 2013, 09:22:18 am
I also have random characters showing up on my LCD, with a ds18B20 sensor near a relay board that has no physical connection to the Arduino. Every time the relays engage, the display garbles. A .1uf cap between gnd and vcc on the display helped a bit, but not completely. It's definitely a EMI issue. If I move the ds18b20 away from the relay board, the problem goes away. Going to replace the ds18b20 wiring with twisted pair and see if that resolves the issue.

http://www.instructables.com/id/Digital-Arduino-Voltmeter-with-Temperature/
27  Using Arduino / Displays / Solution for displaying Temperature & Humidity on a ST7735R TFT LCD on: July 17, 2013, 08:58:32 am
I recently built a project based on a ST7735R Graphical LCD and a DHT-22 temp/humidity sensor. I thought I'd share the solution I came up with for getting this to work together, and see if there were any improvements the community might offer.

Code:
/*
  Arduino TFT text example
  
  This example demonstrates how to draw text on the
  TFT with an Arduino.
  
  This example code is in the public domain

  Created 15 April 2013 by Scott Fitzgerald
 
  http://arduino.cc/en/Tutorial/TFTDisplayText

Heavily modified by Steve Spence

http://arduinotronics.blogspot.com
 
 */

#include <TFT.h>  // Arduino LCD library
#include <SPI.h>

// pin definition for the Uno
#define cs   10
#define dc   9
#define rst  8  

// pin definition for the Leonardo
// #define cs   7
// #define dc   0
// #define rst  1

// create an instance of the library
TFT TFTscreen = TFT(cs, dc, rst);

// char array to print to the screen
char tempPrintout[6];
char humPrintout[6];




// Example testing sketch for various DHT humidity/temperature sensors
// Written by ladyada, public domain
// Fahrenheit conversion added by Steve Spence, http://arduinotronics.blogspot.com

#include <DHT.h>


#define DHTPIN 2     // what pin we're connected to

// Uncomment whatever type you're using!
//#define DHTTYPE DHT11   // DHT 11
#define DHTTYPE DHT22   // DHT 22  (AM2302)
//#define DHTTYPE DHT21   // DHT 21 (AM2301)

// Connect pin + (middle) of the sensor to +5V
// Connect pin S  (on the right) of the sensor to whatever your DHTPIN is
// Connect pin - (on the left) of the sensor to GROUND
// Connect 10k resistor between S and +

int cycleTime = 2000; // 2 second delay (slow sensor)

DHT dht(DHTPIN, DHTTYPE);

float h;
float t;

void setup() {
  
  // Put this line at the beginning of every sketch that uses the GLCD:
  TFTscreen.begin();

  // clear the screen with a black background
  TFTscreen.background(0, 0, 0);
  
  // write the static text to the screen
  // set the font color to white
  TFTscreen.stroke(255,255,255);
  // set the font size
  TFTscreen.setTextSize(2);
  // write the text to the top left corner of the screen
  TFTscreen.text("Temp (F)",0,0);
    // write the text to the top left corner of the screen
  TFTscreen.text("Humidity (%)",0,60);
  // ste the font size very large for the loop
  TFTscreen.setTextSize(4);

 dht.begin();

}

void loop() {

  // Read the value of the temp/humidity sensor on D2

  // Reading temperature or humidity takes about 250 milliseconds!
  // Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)
  h = dht.readHumidity();
  t = dht.readTemperature();
  t = (t*1.8)+32; //C to F conversion
  
 String tempVal = doubleToString(t, 2);
 String humVal = doubleToString(h, 0);
 // String sensorVal = String(1.234);
 
  // convert the reading to a char array
  tempVal.toCharArray(tempPrintout, 6);
  humVal.toCharArray(humPrintout, 6);

  // set the font color
  TFTscreen.stroke(255,255,255);
  // print the sensor value
  TFTscreen.text(tempPrintout, 0, 25);
  TFTscreen.text(humPrintout, 0, 85);
  // wait for a moment
  delay(cycleTime);
  // erase the text you just wrote
  TFTscreen.stroke(0,0,0);
  TFTscreen.text(tempPrintout, 0, 25);
  TFTscreen.text(humPrintout, 0, 85);
}

//Rounds down (via intermediary integer conversion truncation)
String doubleToString(double input,int decimalPlaces){
if(decimalPlaces!=0){
String string = String((int)(input*pow(10,decimalPlaces)));
if(abs(input)<1){
if(input>0)
string = "0"+string;
else if(input<0)
string = string.substring(0,1)+"0"+string.substring(1);
}
return string.substring(0,string.length()-decimalPlaces)+"."+string.substring(string.length()-decimalPlaces);
}
else {
return String((int)input);
}
}
28  Using Arduino / Project Guidance / Re: Using a Vaisala GMP222 Sensor and CO2 serial box with Arduino UNO on: June 27, 2013, 10:50:38 am
Yes, connect Tx on the GMP222 to Rx on the Arduino, and Rx on the GMP222 to Tx on the Arduino. Should not need +5v, might need Gnd.
29  Using Arduino / Project Guidance / Re: Using a Vaisala GMP222 Sensor and CO2 serial box with Arduino UNO on: June 27, 2013, 10:26:08 am
Not enough data. Need the schematic for the board, or for the serial cable to identify which pins are tx, rx, and gnd, or have a cable in front of me.
30  Development / Suggestions for the Arduino Project / Re: uint64_t in Serial.print on: November 26, 2012, 07:31:21 pm
I was expecting somewhere around 16,000,000,000 bytes .....
Pages: 1 [2] 3 4 ... 15