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 Gen3 PCB: WiFi+BT+GPS+MUSB+Relay !

  • Please log in to reply
1380 replies to this topic

#276 KenF9000

KenF9000

    Ranger 4

  • -----
  • Posts: 389
  • Joined: 04 Jun 2004
  • Loc: UK, East Yorkshire (54N 0W)

Posted 07 April 2023 - 08:52 AM

Modified the code for a SH1106 OLED 128x64 Display, also for a UK DD/MM/YY date format.

 

Code copes with the SSD1306 and the SH1106 depending upon a define in the code.

 

Homebrew.jpg

 

Switches made up, just the nunchuck to test when I get one, clone or original?

 



#277 mlord

mlord

    Fly Me to the Moon

  • *****
  • topic starter
  • Posts: 6,375
  • Joined: 25 Oct 2020
  • Loc: Ottawa, Canada

Posted 07 April 2023 - 09:01 AM

Clone.  100% definitely get a clone.


  • KenF9000 likes this

#278 mlord

mlord

    Fly Me to the Moon

  • *****
  • topic starter
  • Posts: 6,375
  • Joined: 25 Oct 2020
  • Loc: Ottawa, Canada

Posted 07 April 2023 - 02:50 PM

Here is Version v5.29 of the Arduino ESP32 source code for this project.

 

Attached File  esp32_wifi.ino.v5.29.txt   85.93KB   32 downloads

  • Fixed it to work with Nunchucks that return all zeros or all ffff for the calibration data.

At least one person here has reported a clone Nunchuck that gives all zeros for the data, so there are probably a lot of those devices now appearing in the sales channels.  This code should work fine with them.

 

No binary version yet:  we're sitting out an extended power/internet outage here at the moment, so my server equipment is all offline until the lights come back on.  Running on generator here for the past two days, but my ISP's batteries must have run out.  smile.gif

 

EDIT: Binary version also now available at https://rtr.ca/teles...stuff/flashing/

 

Cheers


Edited by mlord, 08 April 2023 - 09:49 AM.


#279 KenF9000

KenF9000

    Ranger 4

  • -----
  • Posts: 389
  • Joined: 04 Jun 2004
  • Loc: UK, East Yorkshire (54N 0W)

Posted 09 April 2023 - 08:15 AM

One thing I have noticed with the OLED is that after 2 mins of getting the fix the display outputs the "----" to all fields.

Would it be possible to keep the last data set on display.

 

Actually just done this with

// *** Begin OLED support  ****************************************************************************************************
#if OLED_ENABLED
#include <SSD1306AsciiWire.h>

#define OLED_I2C_ADDRESS 0x3c
#define MMDDYY           false // true - American MM/DD/YY Date format, false gives DD/MM/YY UK format
#define D128x64          true  // Larger than std 128x32 display

static SSD1306AsciiWire oled; // 0X3C+SA0 - 0x3C or 0x3D
static bool oled_detected = false;
#if D128x64
  static int row_inc = 3;
#else
  static int row_inc = 0;
#endif

static void oled_setup ()
{
  //Wire.begin();
  Wire.beginTransmission(OLED_I2C_ADDRESS);
  oled_detected = (Wire.endTransmission() == 0);
  if (!oled_detected) {
    Serial.println("OLED not detected");
  } else {
    Serial.println("OLED detected");
    Wire.setClock(400000L);
    oled.begin(&SH1106_128x64, OLED_I2C_ADDRESS); //Select type of display. See SSD1306init.h
    oled.setFont(System5x7);
    oled.clear();
  }
}

static void oled_write_row (int row, const char *text)
{
  Wire.setClock(400000L);
  oled.setRow(row);
  oled.setCol(0);
  oled.print(text);
  oled.clearToEOL();
}

static void gps_oled_update (void)
{
  static bool had_gps = true;
  static bool had_fix = false;
  static long next_update = 0;
  if (!oled_detected || (next_update && time_before(millis(), next_update)))
    return;
  next_update = get_timeout(1000);  // update once every second

  char text[50];
  #if D128x64
      oled_write_row(0, "HOMEBREW GEN3 - mlord");
      oled_write_row(1, "WiFi+BT+GPS+MUSB+RLY.");
  #endif

  if (!gps_detected) {
    if (had_gps) {
      had_gps = false;
      //oled.clear();
      oled_write_row(0 + row_inc, "GPS not detected.");
    }
    return;
  }
  had_gps = true;
 
  if (gps_has_fix) had_fix = true;

  snprintf(text, sizeof(text), "GPS Sats: %02u/%02u", gps.satellites.value(), gps.satellitesInView());
  oled_write_row(0 + row_inc, text);

  if (had_fix)
    snprintf(text, sizeof(text), "Latitude:  %c%9s", ((gps.location.lat() < 0.0) ? 'S' : 'N'), String(fabs(gps.location.lat()), 5).c_str());
  else
    snprintf(text, sizeof(text), "Latitude:  ----.-----");
  oled_write_row(1 + row_inc, text);

  if (had_fix)
    snprintf(text, sizeof(text), "Longitude: %c%9s", ((gps.location.lng() < 0.0) ? 'W' : 'E'), String(fabs(gps.location.lng()), 5).c_str());
  else
    snprintf(text, sizeof(text), "Longitude: ----.-----");
  oled_write_row(2 + row_inc, text);

  snprintf(text, sizeof(text),
    ((gps_has_fix) ? "%02d/%02d/%02d UTC %02d:%02d:%02d" : "--/--/-- UTC --:--:--"),
  #if MMDDYY
    gps.date.month(), gps.date.day(),    gps.date.year() % 100,
  #else
    gps.date.day(),   gps.date.month(),  gps.date.year() % 100,
  #endif
    gps.time.hour(),  gps.time.minute(), gps.time.second());
  oled_write_row(3 + row_inc, text);
}
#endif /* OLED_ENABLED */
// *** End OLED support  ****************************************************************************************************


Edited by KenF9000, 09 April 2023 - 09:12 AM.


#280 mlord

mlord

    Fly Me to the Moon

  • *****
  • topic starter
  • Posts: 6,375
  • Joined: 25 Oct 2020
  • Loc: Ottawa, Canada

Posted 09 April 2023 - 09:38 AM

So, a couple of reminders to people now receiving and assembling HomeBrew Gen3 units.  The schematic is in Post #3 of this very thread, here:  https://www.cloudyni.../#entry12343255

 

And an explanation of what the switches and connectors do is also earlier in this very thread, here:  https://www.cloudyni...6#entry12460369



#281 mlord

mlord

    Fly Me to the Moon

  • *****
  • topic starter
  • Posts: 6,375
  • Joined: 25 Oct 2020
  • Loc: Ottawa, Canada

Posted 09 April 2023 - 10:11 AM

Some people may be wondering how I manage to attach the micro slider switches to the Gen3c PCB.  Well, here are some photos showing the steps.

 

First, the USB switch:  This MUST be done BEFORE the ESP32 module gets attached -- nearly impossible to do after the fact.  Here is what I do for this one:

 

sw1.jpg

 

A pair of posts are adjusted for an offset as shown, and soldered in place:

 

sw2.jpg

 

The black plastic joining them is then pulled off (pliers) and one post is bent at an angle:

 

sw3.jpg

 

The switch is positioned, and held with one hand while soldering the first pin later.  FLUX helps a LOT here!

 

sw4.jpg

 

 

 

sw5.jpg

sw6.jpg


Edited by mlord, 09 April 2023 - 10:22 AM.

  • 12Bass and fdboucher like this

#282 mlord

mlord

    Fly Me to the Moon

  • *****
  • topic starter
  • Posts: 6,375
  • Joined: 25 Oct 2020
  • Loc: Ottawa, Canada

Posted 09 April 2023 - 10:13 AM

And here is the WiFi switch, which is done AFTER the ESP32 module has been soldered in place.  Notice that the GND pin was pushed all the way through (up) before soldering, and left in place as other pins got trimmed away.  The WiFi hole was left completely empty:

 

wsw1.jpg

 

Now an extra long pin or stiff wire is bent and soldered into the WiFi hole, top and bottom:

 

wsw2.jpg

 

And the switch is then soldered in place.  Flux on the switch and pins helps a LOT here.  Also take care that the metal casing of the switch does NOT touch the (cut-off) VIn (5V) pin!!

 

wsw3.jpg


Edited by mlord, 09 April 2023 - 08:45 PM.


#283 mlord

mlord

    Fly Me to the Moon

  • *****
  • topic starter
  • Posts: 6,375
  • Joined: 25 Oct 2020
  • Loc: Ottawa, Canada

Posted 09 April 2023 - 11:09 AM

Here is v5.30 of the Arduino ESP32 source code for this project.  Version v5.29 was a bust -- the new Nunchuck code was in the wrong place.  FIXED.  Also, the recent OLED updates from KenF9000 have now been merged.

 

Attached File  esp32_wifi.ino.v5.30.txt   84.86KB   42 downloads

 

The binary flash version has also now been updated here:  https://rtr.ca/teles...stuff/flashing/

 

Cheers

 

 

 



#284 mlord

mlord

    Fly Me to the Moon

  • *****
  • topic starter
  • Posts: 6,375
  • Joined: 25 Oct 2020
  • Loc: Ottawa, Canada

Posted 09 April 2023 - 12:59 PM

I'm going to have some 3D-printed enclosures made for the HomeBrew Gen3 device.  My options for materials include these:

  • Black SLA resin
  • "Imagine Black" SLA resin
  • SLS 2101PA-F Nylon black
  • MJF PA12-HP Nylon dyed black
  • FDM (ABS) black

The first (SLA) option is by far the least expensive, but they are all somewhat "affordable".

 

As it turns out, the shipping costs were prohibitive for me to have that done, as it works out to about $10/box all-in.  Too much.  So, not doing that after all.

 

[the .STL files will be posted here soon for people to print their own]


Edited by mlord, 09 April 2023 - 08:48 PM.


#285 Zoroastro

Zoroastro

    Mariner 2

  • *****
  • Posts: 219
  • Joined: 06 Jun 2017

Posted 09 April 2023 - 02:38 PM

PETG and FDM printer, by far the best compromise 


Edited by Zoroastro, 09 April 2023 - 02:38 PM.

  • pbddict1 likes this

#286 MikeHC8

MikeHC8

    Viking 1

  • -----
  • Posts: 759
  • Joined: 09 Dec 2018
  • Loc: Oakland Tennessee

Posted 09 April 2023 - 07:22 PM

Thanks to everyone for 5.3, just installed and the Nintendo Nunchuk works great with alignment or not didn't find any problems at this time, will put it under 3 to 4 hour test next Saturday.  I am using NexStar GPS 11 and Gen 3 is must for anyone with this older mount.  No more waiting for GPS, and you now use WiFi to perform 3 Star Alignment.  I have the  4.22 Hand Controller with another adapter for WiFi but you no longer need the Hand Controller to do anything before connecting to SkySafari.  I keep the H.C. off the scope, this is a great upgrade for your GPS type Scope, 5 seconds to load and ready to align with so many objects to choose you can't go wrong, Big Thank to MLord......


  • mlord likes this

#287 mlord

mlord

    Fly Me to the Moon

  • *****
  • topic starter
  • Posts: 6,375
  • Joined: 25 Oct 2020
  • Loc: Ottawa, Canada

Posted 10 April 2023 - 09:13 AM

..the HomeBrew Standalone PCBs!  smile.gif

 

standalone.jpg

 

These can be used on their own, to interface pretty much any 3.3V microprocessor to the AUX bus (with appropriate firmware/software), or in combination with a Gen3 PCB to create a HomeBrew AUX Relay:

 

Oddly, I never actually had opportunity to use one of these boards until now.  And there is an ERROR on them.  The labels for the BusyIn and BusyOut pins are swapped.

 

So the pins/pads labelled as "BO" or "BusyOut" are actually the "BusyIn" pin/pads.

And the ones labelled as " BI " or "BusyIn" are instead the "BusyOut"  pin/pads.

 

I believe only two or three other people have one of these boards, so if you are reading then please take note of this correction!

 

I missed this first time around, because I tested with a Nexstar+ hand-controller on the Relay side, and it worked (and still works) just fine with the swapped signals -- probably ignoring them.   But the StarSense hand-controller wants them right way around, as do other accessories! 


Edited by mlord, 10 April 2023 - 08:59 PM.

  • fdboucher likes this

#288 mlord

mlord

    Fly Me to the Moon

  • *****
  • topic starter
  • Posts: 6,375
  • Joined: 25 Oct 2020
  • Loc: Ottawa, Canada

Posted 14 April 2023 - 03:09 PM

I know almost nothing about 3D printing.  So I have asked a pal of mine to try and create a slim case for the HomeBrew Gen3 with Nunchuck adapter.  He is still "tweaking", but meanwhile I got another friend to print me one of those designs.  This is a first attempt in black ABS, stuck onto my Evolution mount with Velcro:

 

HomeBrew_Gen3c.jpg

 

Quite rough, and some sanding was necessary for the outer and inner faces.  Note the tiny hole I drilled to allow the three BLUE BLINKS to be visible.  smile.gif  Also, the 3D model didn't account for shrinkage of the ABS, and so things were a rather TIGHT fit.  But the HomeBrew did get shoe-horned in place after some trimming.

 

This model isn't quite ready for "prime time" yet.  I'd like something that is easy for others to self-print, or have a friend print for them.  This ain't that (yet).  smile.gif

 

I may finally have to give in and get a 3D printer myself.


Edited by mlord, 15 April 2023 - 07:57 AM.

  • Chote and Mike_vs_Mosquitoes like this

#289 pbddict1

pbddict1

    Explorer 1

  • *****
  • Posts: 82
  • Joined: 06 May 2018
  • Loc: Stamford, NY

Posted 14 April 2023 - 08:08 PM

I'm more than happy to share my STLs if you like.
I can delete my USB/cord hole and make a nice cutout for the RJ jack if you can send height/width dimensions and a couple closeup pics of that end of the bizz.

#290 hpservertech

hpservertech

    Vostok 1

  • *****
  • Vendors
  • Posts: 184
  • Joined: 11 Jul 2021

Posted 17 April 2023 - 07:27 PM

Can someone test this process out that has a 128x64 oled?

 

put the following settings in:

#define GPS_ENABLED               true

#define OLED_ENABLED             true

#define OLED_D128x64      false

 

Upload sketch

OLED should have large fonts

Unplug USB cable from laptop & plug back in.  

OLED should have large fonts

 

Now, do the following change:

#define OLED_D128x64      true

 

Upload sketch.  After device reset leave connected to USB.

Display should look correct now.

 

Now, unplug the USB cable then plug back in.  Does OLED turn on at all?  It shouldnt, even though code was just uploaded for the correct OLED.

 

To get it to display again, change back to false:

#define OLED_D128x64      false

 

Unplug USB cable and plug back in, display should return.

 

Edited to reflect correct test to run, missed a step.


Edited by hpservertech, 17 April 2023 - 07:57 PM.


#291 mlord

mlord

    Fly Me to the Moon

  • *****
  • topic starter
  • Posts: 6,375
  • Joined: 25 Oct 2020
  • Loc: Ottawa, Canada

Posted 17 April 2023 - 08:41 PM

Can someone test this process out that has a 128x64 oled?

I could well have mucked up the originally contributed code when merging it.  Do let me know what is found here.  Meanwhile, I have now ordered one of those SH1106 OLEDs to try out myself -- should arrive late tomorrow (Tuesday).

 

Cheers        



#292 hpservertech

hpservertech

    Vostok 1

  • *****
  • Vendors
  • Posts: 184
  • Joined: 11 Jul 2021

Posted 17 April 2023 - 08:56 PM

Be careful with some of the clones.  Some of them have the vcc & gnd pins reversed.  It is usually with the blue displays but I have seen it on the white ones as well.

 

I am starting to wonder if I had made an assumption when it was mentioned that the BT was BT classic.  I dont use CPWI, SkyPortal, Sky Safari, etc.  Was hoping I would be able to control either my AVX or CGEM mounts using BT SPP.  If the HC has to be connected I am fine with that, but was hoping this would allow me to use something like Nina, SGP, etc over BT.  If I can use it over BT then I will have some follow up questions because I am seeing no output on the outgoing BT serial port.

 

Also, I read through all the posts (3 times actually) and I could only find 3 posts that mentioned Output and none were talking about what the output pins were used for.  My assumption is they could be connected to some external device like a 5v relay but I am at my limit of assumptions for the day.



#293 mlord

mlord

    Fly Me to the Moon

  • *****
  • topic starter
  • Posts: 6,375
  • Joined: 25 Oct 2020
  • Loc: Ottawa, Canada

Posted 18 April 2023 - 07:59 AM

.. I could only find 3 posts that mentioned Output and none were talking about what the output pins were used for.

Which "Output pins" are you thinking of here?  The Gen3c board has a 3-pin block labelled "Output", which provides +5V, GND, and the raw (nominal) +12V from the AUX bus.  Those can be used to power other low-current accessories if needed, within the limits of the AUX bus.

 

Celestron doesn't seem to say what that limit is, but I imagine that everything connected to the mount should add up to no more than 1A @ 12V.  All of the Celestron branded stuff seems to use 7805 style linear regulators to inefficiently convert the 12V down to 5V, so there's not a huge amount of headroom remaining after plugging a (Celestron) GPS, hand-controller, Focus Motor, and StarSense Camera.  Perhaps another 0.5A max would be my guess.

 

The 5V output on the Gen3c is provided by the onboard DC Buck converter.  The ones I normally use are probably good for about 1A output at 5V, drawing less than 0.5A at 12V from AUX at full load.  But I would not run them flat out all the time at that draw (no heat-sinking).  So keep under that limit.


Edited by mlord, 18 April 2023 - 08:23 AM.


#294 scopewizard

scopewizard

    Apollo

  • *****
  • Posts: 1,400
  • Joined: 04 Oct 2010
  • Loc: Alberta, Canada

Posted 18 April 2023 - 08:02 AM

I use BT on my CGX.

You need to pair it on your laptop.

Right click on BT on the tray icon and select add device.

After it is pair, use CPWI to connect via USB. 

CPWI is the software replacement for your HC.

It also acts like a hub.

After you are connected, you can connect PHD2 to the mount with Ascom CPWI.

In NINA, you can connect the mount also with Ascom CPWI.

With using CPWI, you can make multiple connections to the mount but if you don't you are limited to one only.

 

On mine, no HC connected, Homebrew connected to AUX, BT pair to on scope minipc, use CPWI/USB than minipc wifi to laptop using RDP.

All work very well.


Edited by scopewizard, 18 April 2023 - 08:05 AM.

  • mlord likes this

#295 hpservertech

hpservertech

    Vostok 1

  • *****
  • Vendors
  • Posts: 184
  • Joined: 11 Jul 2021

Posted 18 April 2023 - 09:50 AM

Thanks scopewizard that helped.  Knowing that cpwi would be required was the piece I was missing.



#296 KenF9000

KenF9000

    Ranger 4

  • -----
  • Posts: 389
  • Joined: 04 Jun 2004
  • Loc: UK, East Yorkshire (54N 0W)

Posted 18 April 2023 - 09:54 AM

Can someone test this process out that has a 128x64 oled?

 

put the following settings in:

#define GPS_ENABLED               true

#define OLED_ENABLED             true

#define OLED_D128x64      false

 

Upload sketch

OLED should have large fonts

Unplug USB cable from laptop & plug back in.  

OLED should have large fonts

 

Now, do the following change:

#define OLED_D128x64      true

 

Upload sketch.  After device reset leave connected to USB.

Display should look correct now.

 

Now, unplug the USB cable then plug back in.  Does OLED turn on at all?  It shouldnt, even though code was just uploaded for the correct OLED.

 

To get it to display again, change back to false:

#define OLED_D128x64      false

 

Unplug USB cable and plug back in, display should return.

 

Edited to reflect correct test to run, missed a step.

Is this now resolved, happy to give your test a try if not.



#297 hpservertech

hpservertech

    Vostok 1

  • *****
  • Vendors
  • Posts: 184
  • Joined: 11 Jul 2021

Posted 18 April 2023 - 10:52 AM

Here is a fix for the 128x64 oled:

Wire.setClock(400000L);
    if (OLED_D128x64 == true)
      oled.begin(&Adafruit128x64, OLED_I2C_ADDRESS);
      else
      oled.begin(&Adafruit128x32, OLED_I2C_ADDRESS);
    oled.clear();

 

I think someone else had requested this as well.  Since the GPS goes to sleep after X amount of time is it possible to also put the OLED sleep or if it stays on to continue to display the last fix?  The downside to putting the oled to sleep is if someone wanted to wake it up, would need a pin for that but if it is also put to sleep at least then the oled light wouldnt be on all the time.  These OLED's have a life of 2000 hours so keeping them off when possible is a good idea.


Edited by hpservertech, 18 April 2023 - 10:58 AM.


#298 hpservertech

hpservertech

    Vostok 1

  • *****
  • Vendors
  • Posts: 184
  • Joined: 11 Jul 2021

Posted 18 April 2023 - 11:18 AM

The font is correct, no need to change it.



#299 hpservertech

hpservertech

    Vostok 1

  • *****
  • Vendors
  • Posts: 184
  • Joined: 11 Jul 2021

Posted 18 April 2023 - 11:38 AM

No.  You must specify a font to use or you wont get anything on the display.  The font is separate from the display type.  System5x7 is a common font for the ssd1306 displays.  the oled.begin sets the display resolution and the oled.font sets the font to use.   

 

Think of it like your computer.  Your monitor is the display which you can change to any size but the font that you see on the screen stays the same.  They are 2 independent things.

 

You can use the 128x32 font on a 128x64 display, it just wont look right because you told the oled to use half the pixel height so it has to adjust the font.



#300 hpservertech

hpservertech

    Vostok 1

  • *****
  • Vendors
  • Posts: 184
  • Joined: 11 Jul 2021

Posted 18 April 2023 - 11:55 AM

Here is what the 2 displays look like.  one is 128x32 the other is 128x64.  

 

If you use the code I posted and then only change 

#define OLED_D128x64      true

or

#define OLED_D128x64      false

 

you will see how they differ.

 

The original issue I posted was that the OLED was not being initialized in the original code and it has to be in order to turn on.  I have never used the SH1106 library so I dont know why it wasn't working right.  I have .96", 1.3" & 2.4" 128x64 displays and I tested it on each of them to make sure what I had posted would work on all of the sizes when using the Adafruit code (all clone boards too).

Attached Thumbnails

  • 128x32.jpg
  • 128x64.jpg



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