Dual Counter Support

sforeman00

New Member
I have purchased the dual counter from Hobby boards and have succesufully been able to use the A side of the counter. I was wondering if there are any free software packages that can read both the A and B sides? My only requirement is to log it to a database such as SQL or MySQL.

Thanks
 
I have a similar requirement (home brew electricity monitoring project using a DS2423) so will watch this thread with interest.

In the meantime, I have downloaded the OpenSix 32Bit DDE server software (use google to find - it is free) which can read the 1-wire chips and export the data via DDE to Excel. I think some database software can also accept this format. If not, DDE Server also saves the 1-wire count as a ASCII LOG file.

Let me know if this helps? I need assistance on actually setting up the database side of things!

Cheers
Andrew

I have purchased the dual counter from Hobby boards and have succesufully been able to use the A side of the counter. I was wondering if there are any free software packages that can read both the A and B sides? My only requirement is to log it to a database such as SQL or MySQL.

Thanks
 
Thanks Macca for the response.

I am hoping that someone knows of something that has already been built before I spend time assembling a solution.

Would appreciate a response if there is something out there or someone who might know.
 
I have purchased the dual counter from Hobby boards and have succesufully been able to use the A side of the counter. I was wondering if there are any free software packages that can read both the A and B sides? My only requirement is to log it to a database such as SQL or MySQL.

Thanks

Hi,

I dont see a problem :( using simple Java application will solve your problem, are you look on source code which provide T.Bitson for weather-toys project (lightingsensor or wind speed sensor) ?

Dallas API documentation said :

Code:
Each counter is assosciated with a memory page. The counters for pages 12 and 13 are incremented with a write to the memory on that page. The counters for pages 14 and 15 are externally triggered. See the method readCounter to read a counter directly. Note that the the counters may also be read with the  PagedMemoryBank  interface as 'extra' information on a page read.

And connecting to MySQL is also easy using Connector/J API for Java (download and put in JAR path of project) :

Code:
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

Connection conn = null;
...
try {
	conn = 
	   DriverManager.getConnection("jdbc:mysql://localhost/test?" + 
								   "user=monty&password=greatsqldb");

	// Do something with the Connection

   ...
} catch (SQLException ex) {
	// handle any errors
	System.out.println("SQLException: " + ex.getMessage());
	System.out.println("SQLState: " + ex.getSQLState());
	System.out.println("VendorError: " + ex.getErrorCode());
}


______________________________________________________


import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
import java.sql.ResultSet;

// assume that conn is an already created JDBC connection (see previous examples)

Statement stmt = null;
ResultSet rs = null;

try {
	stmt = conn.createStatement();
	rs = stmt.executeQuery("SELECT foo FROM bar");

	// or alternatively, if you don't know ahead of time that
	// the query will be a SELECT...

	if (stmt.execute("SELECT foo FROM bar")) {
		rs = stmt.getResultSet();
	}

	// Now do something with the ResultSet ....
}
catch (SQLException ex){
	// handle any errors
	System.out.println("SQLException: " + ex.getMessage());
	System.out.println("SQLState: " + ex.getSQLState());
	System.out.println("VendorError: " + ex.getErrorCode());
}
finally {
	// it is a good idea to release
	// resources in a finally{} block
	// in reverse-order of their creation
	// if they are no-longer needed

	if (rs != null) {
		try {
			rs.close();
		} catch (SQLException sqlEx) { } // ignore 

		rs = null;
	}

	if (stmt != null) {
		try {
			stmt.close();
		} catch (SQLException sqlEx) { } // ignore

		stmt = null;
	}
}

Hope that will help for begining.

Regards,
Dubravko
 
Back
Top