electronicramblings.com

Archive for March, 2013

Arduino TVout DS18S20 DS18B20 with Graphing!!!

by on Mar.04, 2013, under Arduino, Arduino ATmega328, Electronic Projects

Another Great Visual Arduino Adventure.

Again this is a more of a reminder for me of the sketch and a working sketch for others to start from.

Now I searched Google for TVout graphing….and found this site: TVout with video overlay.

From this site was able to modify the sketch to be able to graph my DS18x20 sensor. Now that may not seem like a big thing, but I was impressed by being able to do this with a simple 8 bit processor.

The graph up dates about every second and shows the graphed data point in the top left corner. Picture not so good.(Iphone3 just can’t handle the flash that happens on my monitor)

March 03 2013 008

To x,y axis show up on the second rotation of the graph, have not figured out why at this time, but will repost once I do.

Till next time, thanks for your time.

Sketch:
/*
************
Video out with DS18x20 Sensors Graphing
************
electroinicramblings.com
***********
//http://nootropicdesign.com/projectlab/2011/03/20/text-and-graphics-overlay/
Above is where I got the graphing code.
//
Video Out with Maxim/Dallas DS18x20 temperature sensors displayed.
Pin 3 is for 1-wire
Video setup as discribed in Arduino.cc
This simple sketch is to show 1 temperatures on a tv or video monitor
Updates graph aprox. every 1 seconds.
Graph on TV!!!!
March 03, 2013

Important:
any delays you require should be TV.delay(), if not you will loose video.

*/
#include <TVout.h>
#include <font4x6.h>
#include <OneWire.h>
#include <DallasTemperature.h>
// Data wire is plugged into port 10 on the Arduino
#define ONE_WIRE_BUS 3
#define TEMPERATURE_PRECISION 12

TVout TV;

unsigned char x,y;
unsigned char originx = 5;
unsigned char originy = 80;
unsigned char plotx = originx;
unsigned char ploty = 40;
unsigned int n = 0;
int index = 0;

 

//Varibles for temperature Video Out
float T1;

// Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
OneWire oneWire(ONE_WIRE_BUS);

// Pass our oneWire reference to Dallas Temperature.
DallasTemperature sensors(&oneWire);

//Device is a DS18S20 : 10-EC-A7-48-00-08-00-47
DeviceAddress tempa={0X10, 0XEC, 0XA7, 0X48, 0X00, 0X08, 0X00, 0X47}; //DS18S20 temperature senor MAC address

void gtemp()
{
sensors.requestTemperatures(); //Get temperature of all sensors
TV.delay(750);
T1=(sensors.getTempC(tempa));
}

void setup(void)
{
TV.fill(0);
drawGraph();
// randomSeed(analogRead(0));
sensors.begin();
// set the resolution to 12 bit
sensors.setResolution(tempa, TEMPERATURE_PRECISION); //Setup Dallas sensor resolution and address

//Video out setup
TV.begin(NTSC,136,96);
TV.select_font(font4x6);
}

void loop(void)
{
gtemp();

for(int x=6;x>=0;x–) {
if (x<6) {
TV.delay_frame(1);
}

for(byte y=87;y<96;y++) {
TV.draw_line(0, y, 5, y, 0);
TV.draw_line(128, y, 134, y, 0);
}
}

index++;
if (index > 45) {
index = 0;
}

 

TV.print(0,0,” C ARDUINO TEMPERATURE GRAPH”);
TV.print(0,0,T1);

if (plotx++ > 120) {
TV.fill(0);
drawGraph();
plotx = originx + 1;
return;
}
byte newploty = (1/T1)*1000;
newploty = constrain(newploty, 15, originy);

TV.draw_line(plotx-1, ploty, plotx, newploty, 1);
ploty = newploty;
}

void drawGraph()
{
TV.draw_line(originx, 15, originx, originy, 1);
TV.draw_line(originx, originy, 120, originy, 1);
for(byte y=originy;y>15;y -= 4) {
TV.set_pixel(originx-1, y, 1);
TV.set_pixel(originx-2, y, 1);
}
for(byte x=originx;x<120;x += 4) {
TV.set_pixel(x, originy+1, 1);
TV.set_pixel(x, originy+2, 1);
}
}

 

Leave a Comment more...

Arduino TVout with DS18S20 or DS18B20 Video

by on Mar.04, 2013, under Arduino, Arduino ATmega328, Electronic Projects

Arduino and using the TVout Library.

Dam this is a simple project, but good visual results. (Video attached)

Again this is a more of a reminder for me of the sketch and a working sketch for others to start from.

This is a short post just to show how simple it is t work with the TVout library and the Dallas 1-wire library.  The TVout is very well documented at Arduino.cc, and google will take you to even more places showing this feather. And if you are a youtuber….look there.

This is a video of the display showing four temperatures that update approx 5 seconds.

March 03 2013 004 (16megs in size)

Enjoy and hope it shows you more of what you can do with the Arduino system.

Till next time, thanks for your time.

Sketch:

/*
************
TVout with DS18x20 Sensors
************
electroinicramblings.com
***********
Video Out with Maxim/Dallas DS18x20 temperature sensors displayed.
Pin 3 is for 1-wire comms
Video setup as discribed in Arduino.cc
This simple sketch is to show 4 temperatures on a tv or video monitor
Updates aprox. every 7 seconds.
March 03, 2013

Important:
any delays you require should be TV.delay(), if not you will loose video.

*/
#include <TVout.h>
//#include <video_gen.h>
#include <font4x6.h>
#include <OneWire.h>
#include <DallasTemperature.h>
// Data wire is plugged into port 10 on the Arduino
#define ONE_WIRE_BUS 3
#define TEMPERATURE_PRECISION 12

TVout TV;

//Varibles for temperature Video Out
float T1;
float T2;
float T3;
float T4;

// Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
OneWire oneWire(ONE_WIRE_BUS);

// Pass our oneWire reference to Dallas Temperature.
DallasTemperature sensors(&oneWire);

//Device is a DS18S20 : 10-EC-A7-48-00-08-00-47
DeviceAddress tempa={0X10, 0XEC, 0XA7, 0X48, 0X00, 0X08, 0X00, 0X47}; //DS18S20 temperature senor MAC address
//Device is a DS18S20 : 10-22-E1-48-00-08-00-BE
DeviceAddress tempb={0X10, 0X22, 0XE1, 0X48, 0X00, 0X08, 0X00, 0XBE}; //DS18S20 temperature senor MAC address
//Device is a DS18S20 : 10-21-D8-48-00-08-00-90
DeviceAddress tempc={0X10, 0X21, 0XD8, 0X48, 0X00, 0X08, 0X00, 0X90}; //DS18S20 temperature senor MAC address
//Device is a DS18S20 : 10-7F-E2-48-00-08-00-94
DeviceAddress tempd={0X10, 0X7F, 0XE2, 0X48, 0X00, 0X08, 0X00, 0X94}; //DS18S20 temperature senor MAC address

void gtemp()
{
sensors.requestTemperatures(); //Get temperature of all sensors
TV.delay(2000);
T1=(sensors.getTempC(tempa));
T2=(sensors.getTempC(tempb));
T3=(sensors.getTempC(tempc));
T4=(sensors.getTempC(tempd));
}

void setup(void)
{

sensors.begin();
// set the resolution to 12 bit
sensors.setResolution(tempa, TEMPERATURE_PRECISION); //Setup Dallas sensor resolution and address
sensors.setResolution(tempb, TEMPERATURE_PRECISION); //Setup Dallas sensor resolution and address
sensors.setResolution(tempc, TEMPERATURE_PRECISION); //Setup Dallas sensor resolution and address
sensors.setResolution(tempd, TEMPERATURE_PRECISION); //Setup Dallas sensor resolution and address
//Video out setup
TV.begin(NTSC,120,96);
TV.select_font(font4x6);
//Video start screen
TV.println(“”);
TV.println(“”);
TV.println(“”);
TV.println(“Arduino DS18x20 and Video Out”);
TV.println(“”);
TV.println(” DS18x20 and Video Out Demo”);
TV.println(“”);
TV.println(” March 2013″);
TV.delay(5000);
}

void loop(void)
{
gtemp();
TV.clear_screen();
TV.println(“Arduino Temperatures”);
TV.println(” DS18x20 Sensors”);
TV.println(“”);
TV.print(“Temp Deg C: “);
TV.println(T1);
TV.println(“”);
TV.print(“Temp Deg C: “);
TV.println(T2);
TV.println(“”);
TV.print(“Temp Deg C: “);
TV.println(T3);
TV.println(“”);
TV.print(“Temp Deg C: “);
TV.println(T4);
TV.println(“”);
TV.delay(5000);
}

 

Leave a Comment more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...