Photon,Relay Shield and Nextion Touchscreen Based Aquaponics/Indoor Greenhouse

i noticed that when i set the mode to

SYSTEM_MODE(SEMI_AUTOMATIC);

the setup button does not go into listening mode after 3 seconds. How would i change wifi credentials in this scenario?

The button works just the same, even in SEMI_AUTOMATIC, but you might have to wait a bit longer than three sec (reset -> wait 5sec or so -> press and hold till blue blink).

8 posts were split to a new topic: How to remote set any value (e.g. TimeAlarm)?

I have an AM2302 connected to my test rig right now. The AM2303 has a power rating of 3.3-5.5VDC on it. When i connect the power to the 3.3v pins on the photon it works fine but the moment i connect it to a 5V power supply that powers the photon it gives me an error. Is there a requirement to connect a resistor to the power pin when using a 5v power source?

I wouldn’t see a reason why I would want to power the sensor off 5V if it works with 3.3V, but if you need to, try adding a pull-up resistor to the data pin.

1 Like

Because i have a total of 4 that i need to use. Will it be wise to power all of them through the same pin on the photon?

The datasheet for AM2302 says max amps are at 2.5mA and particle docs state that photon can take a max of 100mA. So iis it ok to assumei can connect all 4 sensors to the 3.3v pin of the photon.

@Ali, you can power all the AM2302 via the Vin pin OR, something cool is you can power the via a GPIO pin since 4x3ma = 12ma which is below the max 20ma. That way you can reset or power off the units via the single GPIO. :wink:

In this case the VIN pin is connected to the 5v input power supply. To use a GPIO pin i will have to set it to OUTPUT,HIGH,correct?

@Ali, yes.

Thanks for your help!

1 Like

I am considering using this PH Module from Atlas to sense Ph levels. In the second illustration they have connected the module to the analog pins of the arduino. Would the same apply for a Photon?

They also have an EC module that i want to use but will try the Ph first to see if it all works for my purpose.

@Ali, that module uses I2C so it would be connected to pins D0/D1 of the Photon. The Arduino uses different pins for I2C which are also used as Analog inputs.

ok so at the moment. I have 4 AM2302 from D0 to D3. D4 will give power to them all. RX and TX are connected to the nextion. I will need 4 more digital pins to connect botht eh EC and the TDS sensors. Can analogs be converted into Digital IO’s?

As @peekay123 said, if you want to use that Ph module, you'd need to free D0/D1 for it, but you can use A pins just the same as digital pins, but I'd not use A3 and A6/DAC if I don't need to, since these are the only non-5V-tolerant pins.
Just to stay clear of accidental feeding 5V to those pins.

Ahh! Because D0/DI are SDA/SCL. What if i want to add 2 Ph modules? Can i chain them?

I2C is a bus meant to communicate with multiple devices via these two pins.
The easiest is if your sensors allow to set individual bus addresses, but if not, you might still be able to have multiple sensors of the same kind if you can power them mutually exclusive.

You might also like to look at this thread

1 Like

Just like they say in the thread you are a gentlemen and a scholar. Thank you!! I will post back once i have it working or get stuck.

2 Likes

Im trying to set up the Photon to receive serial data from the Nextion. There is a function called sendme that sends 5 bytes of data. I can see that in the emulator but how do i receive that on the Photon. I tried doing

if (Serial.available() > 0) 
    {
   
    char1 = Serial.read();

    }

but i do not receive anything from that. Anyone have any experience with this?

If you want to do that yourself, you’d use a loop or Serial.readBytesUntil() to catch all bytes in one go.
But there is an ITEADLIB_Nextion library I ported that would do that for you.
There’s a function to send the command and its return value would be the Nextion response to that command.

Have a look at the samples

I am using your library. i have thsp and thup on every page on the touchscreen. Now once the page times out on touch press gets back to the screen it originally was. What I want is for it to go to the first page which has a passcode. What I thought was to use sendxy=1 from the touchscreen and then some way to listen for this on the photon.