Jump to content

  •  

CNers have asked about a donation box for Cloudy Nights over the years, so here you go. Donation is not required by any means, so please enjoy your stay.

Photo

HomeBrew All-In-One: WiFi+BT+USB+Ethernet+GPS+Joystick

  • Please log in to reply
663 replies to this topic

#1 mlord

mlord

    Cosmos

  • *****
  • topic starter
  • Posts: 7,777
  • Joined: 25 Oct 2020
  • Loc: Ottawa, Canada.

Posted 17 April 2021 - 02:48 PM

Announcing the ultimate DIY HomeBrew accessory project:

All of the HomeBrew projects combined into a single ESP32-driven board!

 

This project puts everything one might want for their Celestron mount into one seriously cool bit of kit:

 

  -- GPS receiver (clone of SkySync accessory).

  -- WiFi (clone of SkyQLink/SkyPortal accessory).

  -- Ethernet (for reliable, drop-out free communications to CPWI etc..).

  -- USB Host (for Bluetooth from base of Starsense/Nexstar+ USB hand-controllers).

  -- Joystick port (for Atari-2600 Joystick), to control slewing and/or a focus motor.

  -- Perhaps also a USB-Serial PC-Port connection, if wanted.

  -- Automatic-Off for Evolution mount WiFi when different connectivity is used.

  -- Support for old Nexstar GPS mounts, as well as all of the newer ones.

  -- I2C header for other uses including OLED displays.

  -- extra GPIO signals on a header for..  say.. dew heater controls?

 

All of that, while using up only a single AUX port on the mount, and drawing minimal power from the AUX port.  No extra batteries or power cords for any of it.

 

This is nothing new: all of the functions have already been implemented/proven separately in the various other HomeBrew threads on CloudyNights.  The technology works, and it's just a matter of combining things into a single unit that uses fewer connections and less power than having several separate boxes for the same functionality.

 

To begin with, I am soldering up one for myself on a protoboard, for building into a small project box that Velcros to the fork arm of my Evolution mount.  There has been talk already from a couple of folks here about perhaps producing a silk-screened PCB for it at some point, which (if it happens) could make it a lot more accessible to others.

 

As can be seen from the layout photo here, for now I am using off-the-shelf modules.  Nothing too complex, other than a lot of little wires to join them.

 

As always, feel free to join in and play along.  I will publish the wiring diagram and Arduino code for the project as things progress.

 

 

all-in-one-side.jpg


Edited by mlord, 18 April 2021 - 02:47 PM.

  • ScottS, Chote, mclewis1 and 20 others like this

#2 mlord

mlord

    Cosmos

  • *****
  • topic starter
  • Posts: 7,777
  • Joined: 25 Oct 2020
  • Loc: Ottawa, Canada.

Posted 17 April 2021 - 03:11 PM

There is enough space left over on my protoboard for a few extras.  I expect there will be some unassigned GPIO pins remaining after I work out the wiring for this project.  A couple of good uses for those pins might be for temperature probes and dew heater control outputs.

 

I wouldn't attempt to drive the dew heaters from the AUX port power, but the GPIOs could instead drive some solid-state relays to switch an external power source on/off for that purpose.  To make the wiring simple, one could add a driver chip and some DC-power jacks for power-in and multiple switched power-outs.

 

How much current does a dew heater strip want?

 

EDIT:  Answering my own question here: 1-4 amps looks typical.  One can buy resistance wire by the spool rather cheaply, and common types seem to be about 5.5ohms per metre, which works out to a bit more than 2amps of current for a metre of wire at 12V.  So a couple of power MOSFET transistors could each control a decently powerful dew strip.  I just need to reserve a couple of PWM capable GPIOs for the purpose, plus one more for the temperature probes.


Edited by mlord, 17 April 2021 - 08:46 PM.

  • Lookaturanus likes this

#3 descott12

descott12

    Soyuz

  • *****
  • Posts: 3,966
  • Joined: 28 Sep 2018
  • Loc: Patrick county, VA

Posted 17 April 2021 - 04:42 PM

Does the ethernet breakout board have some smarts/interface in it or is simply a physical connector?



#4 mlord

mlord

    Cosmos

  • *****
  • topic starter
  • Posts: 7,777
  • Joined: 25 Oct 2020
  • Loc: Ottawa, Canada.

Posted 17 April 2021 - 05:11 PM

That particular module with the RJ45 ethernet jack has a WizNet W5500 chip on the underside, which is a hyper-intelligent network device -- full TCP/IP/ARP in the chip, with 32KB of packet buffering.  So it completely offloads networking from the main (ESP32) processor. 



#5 demarko69

demarko69

    Mariner 2

  • *****
  • Posts: 266
  • Joined: 20 Feb 2020
  • Loc: Arizona

Posted 17 April 2021 - 10:11 PM

Announcing the ultimate DIY HomeBrew accessory project:

All of the HomeBrew projects combined into a single ESP32-driven board!

 

 

I have one scope, but I have dozen ways ways to talk to it and control it. UPDATE now dozen +1 

Dont forget to add a TFT or OLED display port, for system setup and info. GPS- loc. date & time- IP- ssid- bt- HC MC ver- slew rates- etc. etc. 


  • Sakcyb and mlord like this

#6 tjay

tjay

    Gemini

  • *****
  • Posts: 3,342
  • Joined: 03 Feb 2007
  • Loc: just outside of Toronto

Posted 18 April 2021 - 01:57 PM

Dew Heater control would be super cool.

 

Would it be possible to have additional 12V power outlets for power to a scope as well?

 

A PCB based version would be nice!


Edited by tjay, 18 April 2021 - 03:36 PM.


#7 mlord

mlord

    Cosmos

  • *****
  • topic starter
  • Posts: 7,777
  • Joined: 25 Oct 2020
  • Loc: Ottawa, Canada.

Posted 18 April 2021 - 02:21 PM

I think it'll just have some extra GPIOs on a header for control of things like dew heaters or whatever else is imagined up in the future.  For actual driving of a dew heater, one would wire up a second simpler board with the drivers (transistors or a chip) and power in/out for that purpose.  That'll be a follow-up HomeBrew project I expect!


  • tjay likes this

#8 mlord

mlord

    Cosmos

  • *****
  • topic starter
  • Posts: 7,777
  • Joined: 25 Oct 2020
  • Loc: Ottawa, Canada.

Posted 19 April 2021 - 12:59 PM

This morning I had a go at seeing whether or not the USB Host controller module would co-exist with the W5500 ethernet module.  See, they share the SPI bus, and want different set-ups for it.  But after a few ugly hacks here and there in the libraries, they do seem to work together.  Whew!  Now I can continue soldering up the first prototype!

 

As a bonus, this uncovered a bug in the Ethernet2 library, whereby it won't establish an inbound TCP connection (say, from CPWI) until the originator actually tries to send something.


Edited by mlord, 19 April 2021 - 01:14 PM.


#9 mlord

mlord

    Cosmos

  • *****
  • topic starter
  • Posts: 7,777
  • Joined: 25 Oct 2020
  • Loc: Ottawa, Canada.

Posted 20 April 2021 - 04:21 PM

Here's a question for anyone reading:

 

There are two ways to connect Bluetooth to the mount:

 

1) Directly to the AUX bus, or

2) Over USB from the Nexstar+/StarSense hand-controller.

(Note that the older serial-port hand-controllers are not going to be supported for Bluetooth here).

 

Both of these have been implemented in separate projects already, but they do conflict a bit with each other when trying to combine them in a single device!

 

SkySafari only works with option (2) at present.

CPWI can use option (1) and works fine that way.  But I doubt if anyone would use it.

 

I'm thinking that nobody will actually want option (1) though, unless it can someday be used with SkySafari.

 

Opinions?


Edited by mlord, 20 April 2021 - 04:22 PM.


#10 demarko69

demarko69

    Mariner 2

  • *****
  • Posts: 266
  • Joined: 20 Feb 2020
  • Loc: Arizona

Posted 20 April 2021 - 04:55 PM

I use CPWI



#11 mlord

mlord

    Cosmos

  • *****
  • topic starter
  • Posts: 7,777
  • Joined: 25 Oct 2020
  • Loc: Ottawa, Canada.

Posted 20 April 2021 - 08:35 PM

I use CPWI

Sure, lots of people use it.  But it can also connect just fine over ethernet or wifi, or through a serial cable from the HC.  So does it really need the Bluetooth connection?

 

I do hope to have it in there as a configurable option in some form -- after all, it is near trivial to do.  But the trick is working out a way to not confuse people, as normally Bluetooth is only for hand-controller connections to SkySafari (ugh.. their idea, not mine).


Edited by mlord, 20 April 2021 - 08:35 PM.


#12 ayadai

ayadai

    Mercury-Atlas

  • *****
  • Posts: 2,533
  • Joined: 01 Feb 2021
  • Loc: Northern Mariana Islands

Posted 20 April 2021 - 10:52 PM

Here's a question for anyone reading:

 

There are two ways to connect Bluetooth to the mount:

 

1) Directly to the AUX bus, or

2) Over USB from the Nexstar+/StarSense hand-controller.

(Note that the older serial-port hand-controllers are not going to be supported for Bluetooth here).

 

Both of these have been implemented in separate projects already, but they do conflict a bit with each other when trying to combine them in a single device!

 

SkySafari only works with option (2) at present.

CPWI can use option (1) and works fine that way.  But I doubt if anyone would use it.

 

I'm thinking that nobody will actually want option (1) though, unless it can someday be used with SkySafari.

 

Opinions?

Since the common usage scenario is for CPWI to be primarily used with the USB port or Wifi, and SkySafari to be primarily used with bluetooth or Wifi, I'd go with option 2.



#13 demarko69

demarko69

    Mariner 2

  • *****
  • Posts: 266
  • Joined: 20 Feb 2020
  • Loc: Arizona

Posted 21 April 2021 - 10:21 AM

Sure, lots of people use it.  But it can also connect just fine over ethernet or wifi, or through a serial cable from the HC.  So does it really need the Bluetooth connection?

 

I do hope to have it in there as a configurable option in some form -- after all, it is near trivial to do.  But the trick is working out a way to not confuse people, as normally Bluetooth is only for hand-controller connections to SkySafari (ugh.. their idea, not mine).

I should add I use cpwi with HB ethernet /GPS dongle, taste great less filling, and rock solid.

I am a fan of BT and use it sometimes with the HB ESP32



#14 mlord

mlord

    Cosmos

  • *****
  • topic starter
  • Posts: 7,777
  • Joined: 25 Oct 2020
  • Loc: Ottawa, Canada.

Posted 21 April 2021 - 08:14 PM

An update:  I have now mostly wired up the first prototype, and basic functionality is there.  WiFi and ethernet are working and I imagine GPS would as well if I plugged one into the board.

 

The USB host port works, and relays HC commands/data to/from Bluetooth when run on its own, but isn't yet working as part of the whole when the various bits of firmware are combined together.  Another day should see that all get sorted out.

 

I have not yet wired up the joystick connector or integrated the code for it, and the I2C header is there but nothing is yet connected to it.

 

Surprisingly, there is currently only a single leftover GPIO on the 30-pin ESP32 module.  There exist similar modules with 38-pins, but the extra pins are shared with the on-board flash memory so I don't know if those would be any more useful in practice.

 

The thought at this point is to perhaps add an optional I/O expander chip on the I2C bus, which would provide possibilities for status LEDs and future stuff like thermal controllers etc.

 

Meanwhile, I'll continue to plug away at getting all of the existing HomeBrew projects working together in harmony on this single Arduino set-up.

 

backside.jpg


Edited by mlord, 21 April 2021 - 08:16 PM.

  • ScottS and Chote like this

#15 mlord

mlord

    Cosmos

  • *****
  • topic starter
  • Posts: 7,777
  • Joined: 25 Oct 2020
  • Loc: Ottawa, Canada.

Posted 22 April 2021 - 12:08 AM

The thought at this point is to perhaps add an optional I/O expander chip on the I2C bus, which would provide possibilities for status LEDs and future stuff like thermal controllers etc.

A helpful person has reminded me that the USB Host chip has several available onboard GPIOs that could be used for LEDs and switches etc.  So I will give that a go before adding another chip to the board.

 

Meanwhile though, I seem to have killed my two remaining USB Host boards.. so there'll be a bit of a delay in the project while I get new ones, and also get new spare chips with which to repair the dead boards.


Edited by mlord, 22 April 2021 - 07:41 AM.


#16 mlord

mlord

    Cosmos

  • *****
  • topic starter
  • Posts: 7,777
  • Joined: 25 Oct 2020
  • Loc: Ottawa, Canada.

Posted 22 April 2021 - 07:44 AM

Scratch that.  Thinking about it overnight, I remembered the detailed breadboard photos I took of a working setup a couple of months ago..

 

Had another look at the photos, and realized that the silkscreened pin labels on the USB Host board are incorrect -- two of them are reversed from reality.  So, rearranged those two wires on both the breadboard and the soldered version, and.. all is working!

 

So now to continue with more wiring and testing of the various parts.  WiFi, Ethernet, USB-to-Bluetooth are all there and well at present.



#17 mlord

mlord

    Cosmos

  • *****
  • topic starter
  • Posts: 7,777
  • Joined: 25 Oct 2020
  • Loc: Ottawa, Canada.

Posted 22 April 2021 - 12:58 PM

A helpful person has reminded me that the USB Host chip has several available onboard GPIOs that could be used for LEDs and switches etc.

It turns out that the USP Host module provides sixteen (16!) GPIOs.  Eight are input-only, with built-in pull-up resistors, and the other eight are output-only, with decent drive capability.

 

So I have incorporated those, freeing up lots of pins on the ESP32 module as a result.  The five joystick button-switches, and the three slider "mode" switches have gone there, as well as a couple of LEDs for the USB-BT status.  This still leaves six output-only GPIOs there, while freeing up eight more-capable GPIOs on the ESP32.

 

The upshot of which, is that this design does ALL of the HomeBrew stuff, and still has significant capability left over for future additions.

 

Still merging all of the various HomeBrew software stuff together.  But getting there!


Edited by mlord, 22 April 2021 - 12:59 PM.

  • mich_al likes this

#18 mich_al

mich_al

    Cosmos

  • *****
  • Posts: 8,204
  • Joined: 10 May 2009
  • Loc: Rural central lower Michigan Yellow Skies

Posted 22 April 2021 - 03:31 PM

ESP32 called out in these threads arrived but none of my USB cables are the correct ones.  What is the name of THIS variant ?  

 

OK I found a cable but still should order some.  Is this a type micro B ?

When plugged in the IDE does not ID a com port so no 'Board info' or upload.

 

Using :

*  First, select Board="ESP32 Dev Module".
*  -- Now choose Partition Scheme="Huge APP (3MB..)".
*  -- and also CPU Frequency = 80Mhz (WiFi/BT).
*

This is the ESP32  :

https://www.amazon.c...0?ie=UTF8&psc=1


Edited by mich_al, 22 April 2021 - 07:12 PM.


#19 mlord

mlord

    Cosmos

  • *****
  • topic starter
  • Posts: 7,777
  • Joined: 25 Oct 2020
  • Loc: Ottawa, Canada.

Posted 22 April 2021 - 07:30 PM

Yes, that's a USB micro-B connector.

 

I hope to be publishing wiring details for the All-In-One within the next couple of days now, after I re-test a couple of things before finalizing it all.

 

There _will_ be a custom printed circuit board produced for the design at some point as well, which is good because there are more than a few wiring connections involved.  :)



#20 mlord

mlord

    Cosmos

  • *****
  • topic starter
  • Posts: 7,777
  • Joined: 25 Oct 2020
  • Loc: Ottawa, Canada.

Posted 22 April 2021 - 08:14 PM

Here is the current list of wiring connections for this project.

I don't really expect anyone else here to wire it up on breadboard, but if you are so inclined..  smile.gif

 

ESP32 module connections:

VIN:     5V from DC-to-DC buck converter fed by 12V from AUX bus.
3V3:     3.3V output power to MAX3421E,W5500,74HC125, and everything else.
GND:     Shared common GND with everything including AUX bus.
GPIO01:  (ESP32 module Serial TX to USB)
GPIO02:  (ESP32 module Serial RX from USB)
GPIO34:  Serial RX from GPS module
GPIO22:  I2C bus SCL for I2C header
GPIO21:  I2C bus SDA for I2C header
GPIO23:  SPI bus MOSI for MAX3421E and W5500
GPIO19:  SPI bus MISO for MAX3421E and W5500
GPIO18:  SPI bus SCLK for MAX3421E and W5500
GPIO5:   SPI bus Slave Select (SS/CS) for MAX3421E
GPIO15:  SPI bus Slave Select (SS/CS) for W5500
GPIO17:  INT signal from MAX3421E
GPIO16:  Serial RX from AUX bus via 74HC125
GPIO4:   Serial TX to AUX bus via 74HC125
GPIO35:  BUSY/RTS input from AUX bus via 74HC125
GPIO32:  BUSY/RTS output to AUX bus via 74HC125

 

Unassigned GPIOs:
GPIO36:
GPIO39:
GPIO33:
GPIO25:
GPIO26:
GPIO27:
GPIO14:
GPIO12:
GPIO13:

GPIO2:

Some of those unassigned GPIOs are input-only, and I may yet move AUX
bus RX to one of them to free up bidirectional GPIO16 for other uses.

 

The I2C header is 4-pins in standard order: 1=GND, 2=3V3, 3=SDA, 4=SCL.

The GPS header is 4-pins: 1=GND, 2=RX-from-GPS, 3=no-connection, 4=3V3.

The Joystick header is 2x5 pins, with a key pin (X) removed.
Top view:
   6 7 8 9 X
   1 2 3 4 5
Five of those are wired to MAX3421E GPIO inputs (GPI#):
8=GND, 6=GPI3, 4=GPI5, 3=GPI4, 2=GPI6, 1=GPI7

 

Also wired to MAX3421E GPIO inputs (GPI#) are three slider switches,
on GPI0, GPI1, and GPI2.  Each of the switches closes to GND.

 

The MAX3421E also has eight GPIO outputs (GPO#), two of which are assigned thus far:
GPO0: externally visible green  LED: USB connection status.
GPO1: externally visible yellow LED: Bluetooth connection status:
The cathodes of each LED go to the GPO# pins; the anodes share a 470-ohm resistor tied to 3V3.

 

The 74HC125 is wired the same as for the HomeBrew Wifi, but without the 330ohm series resistors.  http://zippy/esp32_w...gps_project.jpg  It does have a 50K pull-up to +5V on each of pins 4 and 6 of the AUX bus.

 

The photo is missing the two LEDs:

allinone.jpg


Edited by mlord, 23 April 2021 - 08:16 AM.

  • ScottS likes this

#21 mlord

mlord

    Cosmos

  • *****
  • topic starter
  • Posts: 7,777
  • Joined: 25 Oct 2020
  • Loc: Ottawa, Canada.

Posted 22 April 2021 - 08:25 PM

A really weird thing happened on the way to this post.  :)

I was working on getting two of the slider switches to function as a WiFi kill switch and a WiFi mode switch.  And discovered that reading from the (miniUSB) GPIOs always returns zero unless the HC is initially plugged into the USB host port.  The HC can then be unplugged again and things continue to work.  Bizarre.

 

So.. poked and prodded at the USB Host Library code for a while, and eventually figured out that simply writing zero to the output GPIOs is enough to override whatever the bug is, and things work after that.  With no more need to plug in the HC.

 

And then I spent nearly two hours fiddling with the actual slider switches and the functionality wanted from them, and nothing was having any effect.

 

Then I noticed that a second HomeBrew WiFi was still plugged into the mount, and apparently that's the one I was connecting to (over WiFi) instead of the unit under test.  Doh!  blush.gif


  • Zednik likes this

#22 mlord

mlord

    Cosmos

  • *****
  • topic starter
  • Posts: 7,777
  • Joined: 25 Oct 2020
  • Loc: Ottawa, Canada.

Posted 22 April 2021 - 08:32 PM

A couple more photos of the build thus far.  I intend to add one more header, which will collect together all of the remaining unused GPIO lines, as well as 3.3V, 5V, and GND.

 

lots_of_headers.jpg

 

That weird shadow around one end of the ESP32 module is where I cut away the perfboard to give the WiFi antenna some clear space in which to do its thing. Also note the extended header pins on the RJ12 assembly, so that a second RJ12 can be plugged into it and mounted elsewhere in the project box:  built-in splitter!

 

backside.jpg


Edited by mlord, 22 April 2021 - 08:48 PM.

  • ScottS and Chote like this

#23 mich_al

mich_al

    Cosmos

  • *****
  • Posts: 8,204
  • Joined: 10 May 2009
  • Loc: Rural central lower Michigan Yellow Skies

Posted 22 April 2021 - 08:47 PM


When plugged in the IDE does not ID a com port so no 'Board info' or upload.

 

Using :

*  First, select Board="ESP32 Dev Module".
*  -- Now choose Partition Scheme="Huge APP (3MB..)".
*  -- and also CPU Frequency = 80Mhz (WiFi/BT).
*

This is the ESP32  :

https://www.amazon.c...0?ie=UTF8&psc=1

 

Q & A  for the ESP32 says to use 'NodeMCU-32S'  as a board type vs 'ESP32 Dev Module' but neither works (presents a com port to the IDE).  Have I picked a ESP32 that is incompatible ?  Maybe a bad chip ?



#24 mlord

mlord

    Cosmos

  • *****
  • topic starter
  • Posts: 7,777
  • Joined: 25 Oct 2020
  • Loc: Ottawa, Canada.

Posted 22 April 2021 - 08:59 PM

Q & A  for the ESP32 says to use 'NodeMCU-32S'  as a board type vs 'ESP32 Dev Module' but neither works (presents a com port to the IDE).  Have I picked a ESP32 that is incompatible ?  Maybe a bad chip ?

Looks like the right style of ESP32 module.  Here are my own settings:

 

ide.jpg


Edited by mlord, 22 April 2021 - 08:59 PM.

  • ScottS likes this

#25 mlord

mlord

    Cosmos

  • *****
  • topic starter
  • Posts: 7,777
  • Joined: 25 Oct 2020
  • Loc: Ottawa, Canada.

Posted 22 April 2021 - 09:01 PM

Oh, you must be saddled with MS-Windows or something.  So you'll have to go hunting for the needed serial port (COM) drivers for the CP210x USB-Serial bridge on the board.




CNers have asked about a donation box for Cloudy Nights over the years, so here you go. Donation is not required by any means, so please enjoy your stay.


Recent Topics






Cloudy Nights LLC
Cloudy Nights Sponsor: Astronomics