My Neptune Apex web interface compatible DIY reef controller

I got some good progress on the bootloader enhancement.

So this is a change in default Arduino bootloader which enable ethernet upload of .bin sketch from target computer via network to SDCard on controller, then restart and replacing current sw version with new one.
Also if we set/have port forwarding then also internet upload is possible?

In this case some simple batch program could be written which first convert .hex to .bin and then send code to target controller and restart it.

Still is there any way to fix controller internal IP to be same all the time?
I mean also after curl -0 http://192.168.0.15/reboot

Bc if we try to upload code from internet and have port forwarding to one IP and after restart IP is changed to some default value then ... we lost connection to controller. Of course this is not problem in local network if we know default IP.

But if we could set fixed IP port to some value then also after restart IP remain the same.
 
D0ughb0y,

TFTP does have multiple modes, ascii, netascii, binary, octet, and image

were you able to resolve the cond stamp initialization issue?

yes. binary is the most compact, and at the transfer rate of 600 bytes per second, it takes between 2- 2.5 minutes to complete the upload.

I found more problems with the code. I have reason to believe the project owner simply put together other people's work (which I think he did a good job), but really has no clue about the code, which explains the way he reacts (very defensive) when I give suggestions etc.

The page claims the timeout is 4 seconds, it is actually 16 seconds. If I change it to actually be 4 seconds, download fails at 32k boundary. I have to move it past 8 to get a full 256k code update. Each timeout tick can do 1 32k block. So for chauvet code which is currently 92k, I need at least 3 timeout ticks. This itself does not look right. The timeout is supposed to be for when you reboot, the time the board waits for an upload, then if nothing comes, it will start the user sketch, and should have nothing to do with the upload. I'll see if I can fix this problem. otherwise, I'll have to keep the timeout at 4 ticks (16 seconds) to be able to upload the chauvet code via ethernet.
 

I've looked at a few. This one is for pure tftp upload only. I think the one that works with either serial or tftp is better.

For all these forks and branches, the root is Massimo's (the arduino owner) source. He said the guy he hired to work on this (for use with Arduino Ethernet board) quit, so he put the incomplete work out on github.

As far as I can tell, the core tftp code for all flavors are all based on (and still is) the original Massimo's project.
 
So this is a change in default Arduino bootloader which enable ethernet upload of .bin sketch from target computer via network to SDCard on controller, then restart and replacing current sw version with new one.
Also if we set/have port forwarding then also internet upload is possible?

In this case some simple batch program could be written which first convert .hex to .bin and then send code to target controller and restart it.

Still is there any way to fix controller internal IP to be same all the time?
I mean also after curl -0 http://192.168.0.15/reboot

Bc if we try to upload code from internet and have port forwarding to one IP and after restart IP is changed to some default value then ... we lost connection to controller. Of course this is not problem in local network if we know default IP.

But if we could set fixed IP port to some value then also after restart IP remain the same.

yes you can configure the bootloader ip to anything. It is 20 bytes written to the end of EEPROM address. I will include a program to do this.
4 bytes router ip
4 bytes subnet mask
6 bytes mac address
4 bytes ip address
2 bytes checksum

(the order is the same order as the ethernet shield W5100 chip register)
I currently store the doser info at the end of eeprom, so I have to adjust that down 20 bytes.
 
Your right, losing the serial option would be a limitation.

No, still haven't fixed the Cond problem, just getting back to it this evening, got distracted looking for a new car, have a test drive booked for tomorrow, so think thats now sorted, so back to conductivity, and ORP.

The measurements the other day were from my fesh water change barrel.

Did you have a cct for float switches for ATO?

I'm also going to try and include a solonoid valve for a 10% auto water change.

Thanks

M
 
ATO float switch is connected directly to arduino pin.

I found out why the tftp transfer is slow by comparing the source to the original. For some reason, they added a delay of 400ms between each 512byte packet. That explains the 600 bytes/second throughput. If I remove it, it is really fast, but stops at 32k boundary. I think since the original code was meant for the Arduino Ethernet board, which has 32k program memory, they did not care beyond 32k. I don't think it was fixed properly to work for programs beyond 32k, so I will try to see if I can fix the core tftp code.
 
Oh my... Respect to u Doughboy!
Got basic PLC knowledge that I can program stuff. Was gonna do this to my tank but still rough on my PLC skills. Anyways... Good job! Might copy ur skills once time permits. Cheers!
 
Ok, Just added Chiller option in addition to Fan.

Built myself an 80W Peltier effect Chiller, not hugely powerful, but tested durin the height of summer does drop the water temp by 6 degrees over 12hrs, which generally is workable.

Also added an ambient too low (6C) which triggers the central heating to override the home automation system, as I have doubts that the heater will be able to maintain the tank temp if the ambient falls below 6C.

M
 
I finished the first version of the bootloader (I'm calling it netload). It now works on atmega2560 and atmega328. You can program using serial or ethernet. The chauvet program uploads in 5 seconds to the mega!!!

The bootloader file is attached to this post.
unzip it and burn it to your (spare) atmega2560 board.
You must have a usbasp programmer with 6 pin icsp connector.
this
http://www.ebay.com/itm/Latest-USBA...584?pt=LH_DefaultDomain_0&hash=item2ed0498860
plus this
http://www.ebay.com/itm/1Pcs-10Pin-...270?pt=LH_DefaultDomain_0&hash=item35d3eda7de

copy the .hex file to your arduino/hardware/tools/avr/bin folder and run these 3 commands

Code:
avrdude -c usbasp -p atmega2560 -P usb -b 115200 -e -u -U lock:w:0x3F:m -U lfuse:w:0xFD:m -U hfuse:w:0xD8:m -U efuse:w:0xFF:m 
avrdude -c usbasp -p atmega2560 -P usb -b 115200 -V -U flash:w:netload_atmega2560.hex 
avrdude -c usbasp -p atmega2560 -P usb -b 115200 -U lock:w:0x0F:m
Then try to upload a sketch using Arduino IDE and usb cable (with or without ethernet shield atached).

Before you can upload via ethernet, you need to convert your compiled sketch from .hex to .bin using command

Code:
avr-objcopy -I ihex -O binary sketch.hex sketch.bin
Then try to upload a sketch .bin via ethernet using command
Code:
curl -T sketch.bin tftp://192.168.0.120
The default ip is 192.168.0.120.

If your local network does not use this format (your router address is not 192.168.0.1), you must change the values using the attached netloadinit.ino program. The program is self explanatory.

If you want to try the Chauvet sketch on this, you must edit utils.ino EEPROM section to this

Code:
///////////////////////////////////////
//   EEPROM
////////////////////////////////////////
#include  <avr eeprom.h="">< avr/eeprom.h >
#define DOSERBLOCKSIZE sizeof(dosedvolume)*MAXDOSERS
#define DCADDR E2END-22-DOSERBLOCKSIZE
</avr>
 

Attachments

  • netload_atmega2560.zip
    4.6 KB · Views: 0
  • netloadinit.zip
    754 bytes · Views: 0
I have received all parts needed for this build, and laid out on my workbench. Kind of daunting. Years ago i worked in an electronics factory assembling circuit boards for CPAP machines, so I have some idea what I am doing. But looking through the schematics, I dont know which plugs are TPPS and which just are TPS. Anyone care to enlighten me? Any other assembly tips people have learned? Such as how to properly fit components on the board? I also see on the diagram that most components feed off the 5v from the Arduino. Do you need to wire that, or does it feed from the pins? Ground in series?

And reading the constant updates to this thing, lets say Doughboy adds functionality next week to control LEDs (he may have already, havent read last week or so worth of posts). Do you guys down your entire system, add the components, then bring it back up? Or do you have 2 units that you swap back and forth? Curious how some handle it.
 
Haven't tried yet, but where do the netloadinit file goes. Do it goes in the Chauvet sketch

it's a stand alone arduino sketch.

I created a github project.

https://github.com/d0ughb0y/NetLoad


chucklez, just do it one step at a time. Once the part works, then add the next part, etc. If you do it all at once and run into a problem, it is harder to figure out what caused the problem. trrs has 4 contacts (like iphone headphone plug). trs has 3, your standard left+right+gnd stereo headphone.
 
chucklez -

I know d0ughb0y answered most of your questions. How for how to handle the adding of future components, will depend on you. For me what I have is 2 stations, I have 1 with just the Arduino and breadboard, and only test code for new components to see how it reacts, then I have another station that I use a protoboard (9cmx15cm) that I use to solder everything together, and then test to see how everything reacts. At that stage I'm checking to make sure ever works as expected. From there I do have a 3rd setup (the actual tank). I pull the unit out that I have in there, and replace it from the one on station 2.
 
I meant more like which plugin is needed for TRRS and which for TRS. such as temp probe, pwm pumps, etc.

I only use 2 trrs. One for Ultrasonic sensor, and one for I2C. Both of these require 4 lines, hence the need for TRRS. Anywhere you need 4 lines, use trrs.

I think someone just used TRRS for all.
 
I used TRRS SMD Connectors for everything, but used the correct TRS or TRRS male end pending what I was doing.

TRS for me was, TEMP, PWM Pumps, Float Sensors
TRRS for me was, Sonar
 
Getting this when trying to upload the bootloader

Code:
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Users\IBM>avrdude -c usbasp -p atmega2560 -P usb -b 115200 -e -u -U lock:w:0x
3F:m -U lfuse:w:0xFD:m -U hfuse:w:0xD8:m -U efuse:w:0xFF:m

avrdude: warning: cannot set sck period. please check for usbasp firmware update
.
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.04s

avrdude: Device signature = 0x1e9801
avrdude: erasing chip
avrdude: warning: cannot set sck period. please check for usbasp firmware update
.
avrdude: reading input file "0x3F"
avrdude: writing lock (1 bytes):

Writing | ################################################## | 100% 0.01s

avrdude: 1 bytes of lock written
avrdude: verifying lock memory against 0x3F:
avrdude: load data lock data from input file 0x3F:
avrdude: input file 0x3F contains 1 bytes
avrdude: reading on-chip lock data:

Reading | ################################################## | 100% 0.01s

avrdude: verifying ...
avrdude: 1 bytes of lock verified
avrdude: reading input file "0xFD"
avrdude: writing lfuse (1 bytes):

Writing | ################################################## | 100% 0.01s

avrdude: 1 bytes of lfuse written
avrdude: verifying lfuse memory against 0xFD:
avrdude: load data lfuse data from input file 0xFD:
avrdude: input file 0xFD contains 1 bytes
avrdude: reading on-chip lfuse data:

Reading | ################################################## | 100% 0.01s

avrdude: verifying ...
avrdude: 1 bytes of lfuse verified
avrdude: reading input file "0xD8"
avrdude: writing hfuse (1 bytes):

Writing | ################################################## | 100% 0.01s

avrdude: 1 bytes of hfuse written
avrdude: verifying hfuse memory against 0xD8:
avrdude: load data hfuse data from input file 0xD8:
avrdude: input file 0xD8 contains 1 bytes
avrdude: reading on-chip hfuse data:

Reading | ################################################## | 100% 0.01s

avrdude: verifying ...
avrdude: 1 bytes of hfuse verified
avrdude: reading input file "0xFF"
avrdude: writing efuse (1 bytes):

Writing | ################################################## | 100% 0.01s

avrdude: 1 bytes of efuse written
avrdude: verifying efuse memory against 0xFF:
avrdude: load data efuse data from input file 0xFF:
avrdude: input file 0xFF contains 1 bytes
avrdude: reading on-chip efuse data:

Reading | ################################################## | 100% 0.01s

avrdude: verifying ...
avrdude: 1 bytes of efuse verified

avrdude done.  Thank you.


C:\Users\IBM>avrdude -c usbasp -p atmega2560 -P usb -b 115200 -V -U flash:w:netl
oad_atmega2560.hex

avrdude: warning: cannot set sck period. please check for usbasp firmware update
.
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.04s

avrdude: Device signature = 0x1e9801
avrdude: NOTE: FLASH memory has been specified, an erase cycle will be performed

         To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: warning: cannot set sck period. please check for usbasp firmware update
.
avrdude: reading input file "netload_atmega2560.hex"
avrdude: error opening netload_atmega2560.hex: No such file or directory
avrdude: input file netload_atmega2560.hex auto detected as invalid format
avrdude: can't open input file netload_atmega2560.hex: No such file or directory

avrdude: write to file 'netload_atmega2560.hex' failed

avrdude: safemode: Fuses OK

avrdude done.  Thank you.


C:\Users\IBM>avrdude -c usbasp -p atmega2560 -P usb -b 115200 -V -U flash:w:netl
oad_atmega2560.hex
 
Back
Top