Wixely / CelestronESPWifi

ESP based wifi adapter for Celestron telescopes
7 stars 0 forks source link

Nexstar keypad, AP mode and pull up #1

Open 5a796d opened 3 years ago

5a796d commented 3 years ago

Tested on nodemcu v3, unfortunately at the moment I don't have the telescope yet but the module is detected on the skyportal app in direct connect mode, I was wondering if it will also work in access point mode and if in the future there will be a way to be able to use it even with nexstar keypad connected even if from what I have read around, the nexstar keypad does not work even with the original wifi module.

Thanks for the project!

Wixely commented 3 years ago

Hi, thanks for the feedback! The code could be converted to connect to a wifi AP easily but I forsee serveral issues in practice as I haven't been able to get it to work on a very quick test:

  1. If you wanted to use a phone hotspot, you would not be able to use the host phone with the App as the wifi clients are firewalled from the host phone apps.
  2. Celestion Wifi adapter needs to sit on 1.2.3.4 to recieve data - so the challenge here is that other devices connected to a normal AP will be on a different subnet by default (192.168.x.x). Solutions to this exist but it may not be convenient: (a) change the whole subnet of all the devices on the router, (b) set up some advanced rules for ip forwarding if you have a suitable router / pfsense.

As for the keypad issue I probably won't be investing too much time into solving this issue as I don't really need it myself. I understand some people prefer to use it when doing things like aligning and looking through the lens. You could try adding a physical switch to disable the TX/RX/RST lines for when you need the keypad? Maybe keep the RX line connected so the App gets feedback on changing position - I don't know if it will work.

5a796d commented 3 years ago

Hi, thanks for the feedback! The code could be converted to connect to a wifi AP easily but I forsee serveral issues in practice as I haven't been able to get it to work on a very quick test:

  1. If you wanted to use a phone hotspot, you would not be able to use the host phone with the App as the wifi clients are firewalled from the host phone apps.
  2. Celestion Wifi adapter needs to sit on 1.2.3.4 to recieve data - so the challenge here is that other devices connected to a normal AP will be on a different subnet by default (192.168.x.x). Solutions to this exist but it may not be convenient: (a) change the whole subnet of all the devices on the router, (b) set up some advanced rules for ip forwarding if you have a suitable router / pfsense.

As for the keypad issue I probably won't be investing too much time into solving this issue as I don't really need it myself. I understand some people prefer to use it when doing things like aligning and looking through the lens. You could try adding a physical switch to disable the TX/RX/RST lines for when you need the keypad? Maybe keep the RX line connected so the App gets feedback on changing position - I don't know if it will work.

For the AP mode that's just what I was interested in knowing, I'll do some tests, maybe using 2 nodemcu, one in direct mode and one ap mode, obviously turning on only what I need.

As for the keyboard it was just a matter of comfort as you specified but it is not strictly essential.

Thanks!

I forgot to tell you something rather important. Being certain buck modules of dubious quality, it is advisable to add a schottky diode style 1N5817 (or better) in series at + 12v coming from aux port, it protects the telescope in case of problems.

5a796d commented 3 years ago

One last question, the pull up resistor on nodemcu I have the doubt that it should be connected on vcc (5v) or on 3v3 pin

Wixely commented 3 years ago

certain buck modules of dubious quality

Thanks for your advice, I know the XL6009 boost converters famously have a flaws if the voltage drops too low but I wasn't aware of the buck converter problems. I do always give a quick test on modules before I use them.

One last question, the pull up resistor on nodemcu I have the doubt that it should be connected on vcc (5v) or on 3v3 pin

If you're talking about the resistor I have in the diagram connecting EN pin to 3v3 for the ESP module - you don't need this in a NodeMCU. Without this resistor the bare ESP will not turn on at all, but inside the NodeMCU board it already has everything it needs to boot up once it gets 5v.

5a796d commented 3 years ago

certain buck modules of dubious quality

Thanks for your advice, I know the XL6009 boost converters famously have a flaws if the voltage drops too low but I wasn't aware of the buck converter problems. I do always give a quick test on modules before I use them.

One last question, the pull up resistor on nodemcu I have the doubt that it should be connected on vcc (5v) or on 3v3 pin

If you're talking about the resistor I have in the diagram connecting EN pin to 3v3 for the ESP module - you don't need this in a NodeMCU. Without this resistor the bare ESP will not turn on at all, but inside the NodeMCU board it already has everything it needs to boot up once it gets 5v.

The diode is just a small protection in case of problems with the buck / step down module, it is not strictly necessary but it is an extra safety, in case of a burn the module does not return to the telescope any ovecurrent / overvoltage

Here's why my nodemcu worked even without pull up resistor, thanks for the tip

5a796d commented 3 years ago

gpio15 on nodemcu has 10k pull down, do I still have to connect the gpio15 pin to gnd?

Wixely commented 3 years ago

Hi @5a796d, no again that is only required for the bare ESP and it will not boot up without it. The NodeMCU does not require it.

Wixely commented 3 years ago

@5a796d I don't know what to say really, maybe I never correctly tested this before - but the keypad is working fine for me with the ESP plugged in. I can even move the keypad and watch it update on the SkyPortal app in realtime. I haven't made any changes to hardware or code but either one of two things has happened: I had assumed it didnt work because of an earlier version of my build and just assumed it would never work, or something inside the scope changes to break this randomly as Sebastian alluded to in his experiments.

Translated:

It was strange: if the ESP8266 was connected without the NPN collector circuit, the RX pin of the ESP8266 could not be driven to GND at all times, as if a very strong (1k?) Pull-up was occasionally switched on at the RX pin of the ESP.

5a796d commented 3 years ago

Hi @5a796d, no again that is only required for the bare ESP and it will not boot up without it. The NodeMCU does not require it.

perfect thanks, i was asking anyway i will do some tests, because both the module you use and my nodembu on the gpio15 has 10k pull down, at most it's just a question of a jumper in case of problems

5a796d commented 3 years ago

@5a796d I don't know what to say really, maybe I never correctly tested this before - but the keypad is working fine for me with the ESP plugged in. I can even move the keypad and watch it update on the SkyPortal app in realtime. I haven't made any changes to hardware or code but either one of two things has happened: I had assumed it didnt work because of an earlier version of my build and just assumed it would never work, or something inside the scope changes to break this randomly as Sebastian alluded to in his experiments.

Translated:

It was strange: if the ESP8266 was connected without the NPN collector circuit, the RX pin of the ESP8266 could not be driven to GND at all times, as if a very strong (1k?) Pull-up was occasionally switched on at the RX pin of the ESP.

Something is not right about your scheme and that of sebastianfoerster86 that you linked, apparently the connections to the aux port seem different and I don't understand why, could you elucidate me just to understand? Thank you

P.S. I am still without a telescope but if you can I would do a test to see if by powering the pin select as per sebastianfoerster86 diagram the keypad remains operational or just does not want to know that it works

Wixely commented 3 years ago

Hi @5a796d, indeed I'm aware that his diagram is different from mine as it was one of the stumbling blocks I had along the way. If you check the other link from wayneholder you can see that his diagram matches mine and that sebastian's appears to be mirrored relative to mine. Additionally if you see the first page of the cloudynights forum post that I linked in the readme, the user johnschnupp is espousing the same concerns you are. This confusion may also be compounded by the fact that RJ12 cables can come in reversed forms and it's possible I even developed it using one of these "bad" cables. I will try improve my diagram if I confirm this is the case.

For me, the way I identified which was the correct pinout was to use a multimeter to find the 12v pin, from that you can determine if you have the reversed version or not. The RST (Select) pin will then be the pin farthest away from that. The TX and RX pins are on each side of the 12v, they are also shorted to each other inside the scope so you can confirm this by using a multimeter in continuity mode on the wires each side of the identified 12v wire. The GND is then the only unidentified pin between all of the identified pins (CST will be opposite side of RST). If you use batteries, the 12v pin can appear as low as 10v sometimes but no other pin is anywhere near this high. During development I tried a lot of different things but in nearly every case the keypad showed an Error 17, thats why I was so convinced that it was broken.

5a796d commented 3 years ago

I understood. thanks for the explanation, the problem of the cable I do not ask myself because I build it, I only had doubts about the connection because the diagrams are different in the connection to the aux port.

thanks again, as soon as the telescope arrives I will test it