My Neptune Apex web interface compatible DIY reef controller

d0ughb0y - I currently don't own an oscilloscope, however I'm going to attempt to make one.

http://www.instructables.com/id/Oscilloscope-THE-EASY-WAY-DIY/?ALLSTEPS


very interesting project. it did not say what bandwidth is can do, but I imagine at least 2mhz.
processing is a very powerful GUI language (arduino IDE is based on processing IDE)

I made a small processing contribution to multiwii (drone) project display a while back. I was amazed at what processing can do, I don't know why it is not more popular.
http://youtu.be/5XqmHboTDRo

I use one like this
https://www.sparkfun.com/products/12065
cheaper from china. you will read a lot of bashing about these oscilloscopes, but I've used mine for years just fine.
 
Cant figure this out. help appreciated.

I have two float switches ATO0, and ATO1, and two outlet pumps defined ATP0 and ATP.

Float switches are between A11-Gnd and A12-Gnd

This doesnt seem to be polling or updating.

//////////////////////////////////////////
// ATO
//////////////////////////////////////////
//use polling code for ATO

void initATO()
{
//ATO1 PortK bit3 PCINT19 analogue pin 11
//ATO2 PortK bit4 PCINT20 analogue pin 12
DDRK &= ~(_BV(PK3)|_BV(PK4)); //Data Direction Register Bit 3 input and Bit 4 input
PORTK |= (_BV(PK3)|_BV(PK4)); //pullups on bit 3, and bit 4
}

inline uint8_t getATO1()
{ return (PINK&_BV(PK3)); }

inline uint8_t getATO2()
{ return (PINK&_BV(PK4)); }



void checkATO()
{
if (conf.outletRec[ATP0].mode == _auto)
{
if (!getATO1() && isOutletOn(Return)
#ifdef _SONAR
&& sonaravg<conf.sonaralertval*10
#endif
) {
_outletOn(ATP0);
return;
}
_outletOff(ATP0);
}
}
 
do you see the status of the ato switch change when you manually move the float up and down? make sure you do not have any "timed" program for the ato pump outlets. they must be set to auto with all times set to 0.
 
do you see the status of the ato switch change when you manually move the float up and down? make sure you do not have any "timed" program for the ato pump outlets. they must be set to auto with all times set to 0.

Hi,

outlets are set for automatic, with no timers attached.

No state change with manual movement of the float switches.

I was reading somewhere that inputs have a pull down and outputs a pull up resistor, clearly to prevent tri state or floating pins.

should I set the pin state low and connect the float switch 5v to pin?

M

void initATO()
{
//ATO1 PortK bit3 PCINT19 analogue pin 11
//ATO2 PortK bit4 PCINT20 analogue pin 12
DDRK &= ~(_BV(PK3)|_BV(PK4)); //Data Direction Register Bit 3 input | Bit 4 input
PORTK &= ~(_BV(PK3)|_BV(PK4)); //pulldown on bit 3 & 4
}

This changes the state to C from O but no updates.
 
Last edited:
you want this to have pullup, as the float switch is not powered.

can you manually switch on/off the outlets?

Ok, outlets switch on and off manually.

I can code the port state which i reported to the lcd, I have removed the floats and used link wires to put an input either H or L, however this is neither read at power up or during updates.

M
 
It is straightforward pin input function. It will work with analog pin. If you are connected correctly, A11 and A12 by arduino notation, and it does not work, perhaps your arduino pins are defective. You can try other arduino pins. And just to make sure, you are using an arduino mega right? since this is direct register access code, it will only work on atmega2560 chip. (I ask because another person was trying this on an arduino due, which use ARM processor).

The reason pins A11 and A12 were used is because I originally was using pin change interrupt function and was using all PORTK pins (I have since changed this to polling every 15 seconds). I will be using 3 of the unused PORTK pins for the PWM fan tachometer input signal, since I will actually be using pin change interrupts to get the RPM information from the fans.

PinMap2560.png


ArduinoMega2560_R3_Fronte.jpg
 
d0ughb0y - how hard would it be to convert this to a Due? Just to get the extra memory? I know it only runs on 3.3v, but that shouldn't be a big deal. Thoughts? Just want your opinion before buying one and trying.
 
Ok, have moved to port L 6&7 and it works.

Might try some diagnostics on A11 and 12.

Thanks

void initATO()
{
//ATO1 PortK bit3 PCINT19 analogue pin 43
//ATO2 PortK bit4 PCINT20 analogue pin 42
DDRL &= ~ _BV(PL6);
DDRL &= ~ _BV(PL7); //Data Direction Register Bit 6 input | Bit 7 input
PORTL |= _BV(PL6);
PORTL |= _BV(PL7); //pull UP on bit 6 & 7
}

inline uint8_t getATO1()
{ return PINL&_BV(PL6); }

inline uint8_t getATO2()
{ return PINL&_BV(PL7); }
void checkATO()
{
if (conf.outletRec[ATP0].mode == _auto)
{
if (getATO1()==0 && isOutletOn(Return))

{
_outletOn(ATP0);
return;
}
_outletOff(ATP0);
}
}
 
d0ughb0y - how hard would it be to convert this to a Due? Just to get the extra memory? I know it only runs on 3.3v, but that shouldn't be a big deal. Thoughts? Just want your opinion before buying one and trying.

I am not familiar with ARM processor architecture, but it will be a major change for sure.

maybe one day when I have time, I'll read the ARM processor datasheet.
 
Last edited:
Ok, have moved to port L 6&7 and it works.

Might try some diagnostics on A11 and 12.

Thanks

void initATO()
{
//ATO1 PortK bit3 PCINT19 analogue pin 43
//ATO2 PortK bit4 PCINT20 analogue pin 42
DDRL &= ~ _BV(PL6);
DDRL &= ~ _BV(PL7); //Data Direction Register Bit 6 input | Bit 7 input
PORTL |= _BV(PL6);
PORTL |= _BV(PL7); //pull UP on bit 6 & 7
}

inline uint8_t getATO1()
{ return PINL&_BV(PL6); }

inline uint8_t getATO2()
{ return PINL&_BV(PL7); }
void checkATO()
{
if (conf.outletRec[ATP0].mode == _auto)
{
if (getATO1()==0 && isOutletOn(Return))

{
_outletOn(ATP0);
return;
}
_outletOff(ATP0);
}
}


great!
 
I'm done with webpage code for pwm fan. I just need to open up my chauvet case and do the wiring and burn the bootloader. I'll probably do the bootloader tonight, then do the pwm fan wiring tomorrow.
 
I'm done with webpage code for pwm fan. I just need to open up my chauvet case and do the wiring and burn the bootloader. I'll probably do the bootloader tonight, then do the pwm fan wiring tomorrow.

I'm gutted didnt understand I need an IVR Mk2 for the Mega, so no hav one on order.

Pity the tiny doesnt work
 
As far as I can tell, the tiny works (that's the usbasp from ebay link I gave recently, I use one exactly like that).
The verify fails, but I think the bug is in the verify code, since I tested all functions of the bootloader (that's the real verify imho) and they all work.

you can also use another arduino to burn the bootloader. You need to burn a sketch to the arduino you are going to use as programmer, then put a capacitor on the reset line so it does not reset, then connect the ICSP pins to the mega. I've tried this a long time ago and it works. So if you just want to burn the bootloader once, and have an extra arduino laying around, you can use the arduino as ISP method.
 
As far as I can tell, the tiny works (that's the usbasp from ebay link I gave recently, I use one exactly like that).
The verify fails, but I think the bug is in the verify code, since I tested all functions of the bootloader (that's the real verify imho) and they all work.

you can also use another arduino to burn the bootloader. You need to burn a sketch to the arduino you are going to use as programmer, then put a capacitor on the reset line so it does not reset, then connect the ICSP pins to the mega. I've tried this a long time ago and it works. So if you just want to burn the bootloader once, and have an extra arduino laying around, you can use the arduino as ISP method.

Well it is the usbasp, hmmm, I'll have another read up.
 
I had to do other things last weekend, so did not get to do much on the controller.
I did burn the bootloader to the mega in my chauvet. The serial upload works, but the ethernet upload does not. I will have to swap the ethernet shield out with the one I tested with. The one I tested with is the original arduino ethernet shield. The one in the controller is a sainsmart brand. Once I swap it out, I can debug it better to figure out why it did not work. The watchdog timer reboot works, so I added an 8 second watchdog timer in my main loop. I don't know if this is going to be feasible since there are times when the webserver can take longer than 8 seconds to complete a transfer. I think there is a way to programmatically extend it, so I'll extend it to 1 minute once I figure out how to do it.

I cannot use the DB9 as I originally planned for the pwm fan connections, since the mega and ethernet shield is right up that side where the DB9 connector used to be. I am now thinking if I should just control 1 fan and use the PWM stereo jack right now that is unused (I have to change it to trrs jack). Or to just completely remove the uln2803 since I will never use outlets 9-16 anymore and use that DB9 connector on the other end for the lines for the 3 pwm fans. I do have a 12v 2a power supply in the chauvet so it should be able to handle 3 fans.

I will build another setup with my spare mega and ethernet shield with circuit on breadboard and use this as my test setup.
 
Back
Top