A Forum run by Enthusiasts of MidNite Solar

The Open Source software/hardware corner => Arduino => Topic started by: phonetic on July 26, 2013, 09:45:22 PM

Title: Simple Arduino Webserver for sucking Classic readings.
Post by: phonetic on July 26, 2013, 09:45:22 PM
I'm looking at using Arduino mega & ethernet board, to get a snap shot of classic readings as a basic website, something basic to allow checking via Android device/smartphone.
I understand Arduino has RS482 & Modbus library's support.
would be great if get some ideas from here :)
Title: Re: Simple Arduino Webserver for sucking Classic readings.
Post by: mtdoc on July 27, 2013, 01:59:20 PM
I know almost nothing about Modbus, but I'm working on setting up an Arduino based voltage and current measurement system for my ePanel.  If some one got the Classics Modbus data working on a 'duino that would be awesome!  I look forward to hearing about your progress.
Title: Re: Simple Arduino Webserver for sucking Classic readings.
Post by: Graham on July 27, 2013, 08:32:33 PM
Quote from: mtdoc on July 27, 2013, 01:59:20 PM
I know almost nothing about Modbus, but I'm working on setting up an Arduino based voltage and current measurement system for my ePanel.  If some one got the Classics Modbus data working on a 'duino that would be awesome!  I look forward to hearing about your progress.

I have a Netduino based monitor on my system (classic lite, VFX3524), it interfaces with the classic lite over Modbus TCP and the Outback Mate over RS232. I made a custom shield that includes an RTC, a watchdog circuit and the RS232 interface (http://netduinosolar.wordpress.com/documentation/making-the-netduinosolar-shield/ (http://netduinosolar.wordpress.com/documentation/making-the-netduinosolar-shield/)). This shield is compatible with the arduino. I've had it running at my off grid cabin for several month now, I'm currently adding support for the TriStar for a couple of smaller systems I've installed.
The C# source is available at https://netduinosolar.codeplex.com// (https://netduinosolar.codeplex.com//).
Title: Re: Simple Arduino Webserver for sucking Classic readings.
Post by: Westbranch on July 27, 2013, 10:05:33 PM
rossgr, I looked around your site, but have trouble finding just which part is and what does a 'shield do?'
thanks, it's an interesting project.
Title: Re: Simple Arduino Webserver for sucking Classic readings.
Post by: Graham on July 27, 2013, 11:18:17 PM
Quote from: Westbranch on July 27, 2013, 10:05:33 PM
rossgr, I looked around your site, but have trouble finding just which part is and what does a 'shield do?'
thanks, it's an interesting project.

A shield is a daughter board that plugs into an arduino or netduino, you can buy a shield for all kinds of projects, see https://www.sparkfun.com/categories/103?page=all (https://www.sparkfun.com/categories/103?page=all).
I used a program called diptrace to create a PCB (printed circuit board) for a custom shield that incorporates the RS232 interface, the RTC and a watchdog circuit needed for my project.


The assembled shield
(http://shield.png)

The prototype
(http://proto.jpg)
Title: Re: Simple Arduino Webserver for sucking Classic readings.
Post by: Graham on July 27, 2013, 11:20:43 PM
Some of the images didn't make it up on my last post

PCB


Side view of shield and netduino
(http://side.png)
Title: Re: Simple Arduino Webserver for sucking Classic readings.
Post by: boB on July 28, 2013, 12:08:58 AM

Ryan, do you think we can UP the allotment for image size a little bit more ?

I think it's 300K total or something small like that.  Maybe more like 1 MegaByte might
be better ?  Then we could have a better view.

boB
Title: Re: Simple Arduino Webserver for sucking Classic readings.
Post by: phonetic on July 28, 2013, 01:25:29 AM
Looking at the specs of the netduino 2 card, looks interesting, price wise a Raspberry-Pi looks more bang for buck, I got mega arduino card has 32k RAM and 256k flash, to support networking, basic arduino card..not enough RAM to manage a TCP/IP stack & misc buffers.

Title: Re: Simple Arduino Webserver for sucking Classic readings.
Post by: mtdoc on July 28, 2013, 01:56:15 AM
rossgr-  You're netduino solar monitor looks great.   Thanks for sharing! :)

Unfortunately netduino requires programming in the .NET framework - which i don't have the time or inclination to learn.  :'(

I can do Arduino or Labview only  :-[
Title: Re: Simple Arduino Webserver for sucking Classic readings.
Post by: Graham on July 28, 2013, 08:45:37 AM
Quote from: mtdoc on July 28, 2013, 01:56:15 AM
rossgr-  You're netduino solar monitor looks great.   Thanks for sharing! :)

Unfortunately netduino requires programming in the .NET framework - which i don't have the time or inclination to learn.  :'(

I can do Arduino or Labview only  :-[

I've also posted another open source project you might find useful, it's a modbus master and slave tool, using the master , you can read the modbus data off the classic and export it to a file which you can then import into the slave. I've used this to test my monitor when I don't have access to my solar equipment.
It's available at http://modbustool.codeplex.com/ (http://modbustool.codeplex.com/)
Title: Re: Simple Arduino Webserver for sucking Classic readings.
Post by: boB on July 28, 2013, 07:42:26 PM

I installed the modbus master on my windows 7 laptop but it has an error.  Some kind of memory
bounds error.  I also tried compatibility mode but no go.

Anybody else have a problem with win 7 and Ross's app ?

boB
Title: Re: Simple Arduino Webserver for sucking Classic readings.
Post by: RossW on July 28, 2013, 09:40:04 PM
Quote from: boB on July 28, 2013, 07:42:26 PM
Anybody else have a problem with win 7 and Ross's app ?

I do....  (I've never compiled it for doze so be curious to know how you run it!)
Title: Re: Simple Arduino Webserver for sucking Classic readings.
Post by: boB on July 28, 2013, 10:41:09 PM
Quote from: RossW on July 28, 2013, 09:40:04 PM
Quote from: boB on July 28, 2013, 07:42:26 PM
Anybody else have a problem with win 7 and Ross's app ?

I do....  (I've never compiled it for doze so be curious to know how you run it!)

I just ran the pre-compiled setup.exe from the code download site.

It installed OK but had the error when trying to run the installed version

I might try the .msi installer but I would think they'd end up being the same.
Maybe not ?

boB
Title: Re: Simple Arduino Webserver for sucking Classic readings.
Post by: RossW on July 28, 2013, 10:55:52 PM
Quote from: boB on July 28, 2013, 10:41:09 PM
Quote from: RossW on July 28, 2013, 09:40:04 PM
I do....  (I've never compiled it for doze so be curious to know how you run it!)

I just ran the pre-compiled setup.exe from the code download site.

ok, my bad. Wrong Ross!
Title: Re: Simple Arduino Webserver for sucking Classic readings.
Post by: mtdoc on July 29, 2013, 12:42:39 AM
Quote from: boB on July 28, 2013, 07:42:26 PM

I installed the modbus master on my windows 7 laptop but it has an error.  Some kind of memory
bounds error.  I also tried compatibility mode but no go.

Anybody else have a problem with win 7 and Ross's app ?

boB

Yep. Screen shot of error below:

Title: Re: Simple Arduino Webserver for sucking Classic readings.
Post by: atop8918 on July 29, 2013, 02:51:35 AM
I've had really good luck with cygwin when doing compiles for Windows. It's a nice way to get your POSIX/*NIX-compatible code running on *doze. It's not perfect and I haven't tried doing any UI stuff since wxWidgets verion 1995 or so, but by and large for small generic programs it works a treat!

Title: Re: Simple Arduino Webserver for sucking Classic readings.
Post by: Graham on July 29, 2013, 12:42:28 PM
Quote from: mtdoc on July 29, 2013, 12:42:39 AM
Quote from: boB on July 28, 2013, 07:42:26 PM

I installed the modbus master on my windows 7 laptop but it has an error.  Some kind of memory
bounds error.  I also tried compatibility mode but no go.

Anybody else have a problem with win 7 and Ross's app ?

boB

Yep. Screen shot of error below:

Are you getting this error when you initially launch the app or does the window display?
Are you trying the Master or the Slave app?

Looking at the code it appears it's failing to allocate a chunk of memory for the modbus data.

I dug out an old XP laptop with 1 gig of ram and installed and ran both the master and slave app without any problems
I also tried it on a vista 32 bit- 4 gig and my windows 7 64 bit 4 gig laptop.

I posted an update to codeplex that checks the memory allocation at startup

If someone has time to try it since I can't reproduce the error here, could you let me know if you get the error "Failed to allocate 64k block" at startup or does the form display (see attached)

Install instructions;
-make sure you un-install any previous version
-download the ModbusTool.zip from the download area of modbustool.codeplex.com
-unzip the file
-run the setup.exe file in the "Modbus Master" folder
-you should be able to use the default install settings
-you may be asked to enter your password to allow it to proceed
- you should now have a blue cube icon (Modbus Master) under start->All Programs

thanks for your help

Graham.
Title: Re: Simple Arduino Webserver for sucking Classic readings.
Post by: Graham on July 29, 2013, 01:12:04 PM
BTW
I changed my display name from rossgr to Graham to avoid confusion with RossW.

I'm the microsoft guy with a couple of open source projects on codeplex

netduinoSolar.codeplex.com: A solar equipment monitor that runs on a netduino
modbustool.codeplex.com: A modbus master and slave tool that (should) run on windows.

RossW is the linux guy...
Title: Re: Simple Arduino Webserver for sucking Classic readings.
Post by: mtdoc on July 29, 2013, 02:08:53 PM
I installed the Master  on my Win 7 laptop 64bit, 4 gig.

Error comes up on initial opening. If I then click continue the app opens up but that error comes up again if I try to do anything.

I have an XP machine at home I can try it on later.



Title: Re: Simple Arduino Webserver for sucking Classic readings.
Post by: Graham on July 29, 2013, 03:27:06 PM
Quote from: mtdoc on July 29, 2013, 02:08:53 PM
I installed the Master  on my Win 7 laptop 64bit, 4 gig.

Error comes up on initial opening. If I then click continue the app opens up but that error comes up again if I try to do anything.

I have an XP machine at home I can try it on later.

I might have found the problem, the code is wrongly expecting at least one serial port for the RTU mode, when it doesn't find any it prematurely exits the initialization routine and never allocates the memory for modbus. All the machines I tried this morning have a serial port. I just tried it on another laptop that has no serial ports, the prior version did display an error at startup, the latest upload worked.

I've posted an update on codeplex.


thanks for your help

Graham.
Title: Re: Simple Arduino Webserver for sucking Classic readings.
Post by: RossW on July 29, 2013, 04:55:29 PM
Quote from: Graham on July 29, 2013, 01:12:04 PM
BTW
I changed my display name from rossgr to Graham to avoid confusion with RossW.

Sorry, that was entirely my fault for reading a new post without looking back at the context.


Quote
RossW is the linux guy...

Not really. FreeBSD is my weapon of choice, but linux is "unix-like" in enough ways for many things to carry over.
Title: Re: Simple Arduino Webserver for sucking Classic readings.
Post by: mtdoc on July 30, 2013, 12:18:52 AM
Quote from: Graham on July 29, 2013, 03:27:06 PM
Quote from: mtdoc on July 29, 2013, 02:08:53 PM
I installed the Master  on my Win 7 laptop 64bit, 4 gig.

Error comes up on initial opening. If I then click continue the app opens up but that error comes up again if I try to do anything.

I have an XP machine at home I can try it on later.

I might have found the problem, the code is wrongly expecting at least one serial port for the RTU mode, when it doesn't find any it prematurely exits the initialization routine and never allocates the memory for modbus. All the machines I tried this morning have a serial port. I just tried it on another laptop that has no serial ports, the prior version did display an error at startup, the latest upload worked.

I've posted an update on codeplex.


thanks for your help

Graham.

That fixed it!  Thanks. Now i just need to find the time to learn more about modbus and play around with it ::)
Title: Re: Simple Arduino Webserver for sucking Classic readings.
Post by: boB on July 30, 2013, 02:23:26 AM
Yep !  I seems to work good !  I like it !

Can you make it automatically update once every so many milliseconds ?  Once per second or so would
be nice but adjustable would be good too.

I'm not sure how you write a single register.  Which register writes ?

It also says "address"  I think you may mean "register" ?  Maybe you do mean address
though.

boB