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
2029 replies to this topic

#1026 Jackey

Jackey

    AutoAligning Software for CPWI

  • *****
  • Vendors
  • Posts: 17
  • Joined: 19 Jul 2023

Posted 18 December 2023 - 10:27 AM

Great thank you Mark for the explanations, I will try then to make a HB3 clone for my mount. I will probably resign from gps option in mine as I have already built a separate one, but this can be a good opportunity to update you if this cheaper gps module works well in your setup as well.

On the other hand I'm surprised you found Ne-180.for 8$, I couldnt find them for less than 20$.

I appreciate the awesome job you guys do here, if I can contribute anyhow let me know;)
Regards
J

Edited by Jackey, 18 December 2023 - 10:28 AM.


#1027 masi

masi

    Explorer 1

  • -----
  • Posts: 53
  • Joined: 09 Nov 2023
  • Loc: Öhningen, Germany

Posted 18 December 2023 - 10:45 AM

How to Hook Up an FRAM Module:

 

Each I2C device has a unique bus "address".   The HBG3 expects FRAM to use 0x50 as the address.  So if the device has jumpers or pins for selecting an address, set it for 0x50, which is normally the default for FRAM, and is the default for the module pictured above.  The A0,A1,A2 lines on that module could be pulled up/down to change the address, but that is not needed here.  The WP (Write-Protect) line is also not used here.

 

Hi Mark

 

Hooked up the FRAM to I2C Bus, if I scan the Bus I can see that Module with Adress 0x50 is detected as well NUN-Chuck and OLED, unfortunately it seems that FRAM Module is not used / detected out of the code. I added some liens in the FRAM setup to check

 

fram_detected = (Wire.endTransmission() == 0);

if(!fram_detected)

  SERIAL_PRINTLN("FRAM not detected");

else

  SERIAL_PRINTLN("FRAM detected");

 

ends always up in not detected

 

any idea?

 

cheers

martin



#1028 mlord

mlord

    Cosmos

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

Posted 18 December 2023 - 11:28 AM

Show me the code that you used to "scan the Bus".  We can change hbg3 code to do it similarly.



#1029 masi

masi

    Explorer 1

  • -----
  • Posts: 53
  • Joined: 09 Nov 2023
  • Loc: Öhningen, Germany

Posted 18 December 2023 - 12:09 PM

Show me the code that you used to "scan the Bus".  We can change hbg3 code to do it similarly.

Found some code here:

 

https://randomnerdtu...on-arduino-ide/

 

 

#include <Wire.h>

void setup() {
  Wire.begin();
  Serial.begin(115200);
  Serial.println("\nI2C Scanner");
}

void loop() {
  byte error, address;
  int nDevices;
  Serial.println("Scanning...");
  nDevices = 0;
  for(address = 1; address < 127; address++ ) {
    Wire.beginTransmission(address);
    error = Wire.endTransmission();
    if (error == 0) {
      Serial.print("I2C device found at address 0x");
      if (address<16) {
        Serial.print("0");
      }
      Serial.println(address,HEX);
      nDevices++;
    }
    else if (error==4) {
      Serial.print("Unknow error at address 0x");
      if (address<16) {
        Serial.print("0");
      }
      Serial.println(address,HEX);
    }   
  }
  if (nDevices == 0) {
    Serial.println("No I2C devices found\n");
  }
  else {
    Serial.println("done\n");
  }
  delay(5000);         
}



#1030 mlord

mlord

    Cosmos

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

Posted 18 December 2023 - 12:25 PM

Okay, that code does exactly what the HBG3 already does.  You'll have to debug it further at your end.



#1031 Astro Andy

Astro Andy

    Explorer 1

  • -----
  • Posts: 60
  • Joined: 10 May 2021
  • Loc: SW UK

Posted 18 December 2023 - 04:05 PM

I've grabbed the v8.27+ via OTA. I don't have a GPS connected but was hoping to grab the time by NTP and input manual Long/Lat and therefore have the GPS screen enabled. It does not appear as it is. What do I need to do? 

 

Add info like this? 

Edit: I see the post below and will add a GPS module as soon as I get the chance. Will GPS time override NTP if it is available? I realise they should be the same so a source indication on the OLED would be useful - a G or I maybe

Attached Thumbnails

  • 1000013389-02.png
  • 1000013392-02.jpeg

Edited by Astro Andy, 18 December 2023 - 04:16 PM.

  • fdboucher likes this

#1032 Rac19

Rac19

    Soyuz

  • *****
  • Posts: 3,910
  • Joined: 05 Aug 2016

Posted 18 December 2023 - 04:34 PM

Okay, done.  But I will NEVER release it unless a couple of people here actually help test it.

Here's the code: DELETED -- stay tuned.

Thanks Mark, I will download and test. I wiil need a telnet client on my phone, by the look of it, My goal has always been to wake from Hibernation with minimal HC interaction and this should do it. A start within a few minutes would have been good enough, instant (or near enough) is better.


Edited by Rac19, 18 December 2023 - 06:04 PM.


#1033 mlord

mlord

    Cosmos

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

Posted 18 December 2023 - 05:09 PM

Fake GPS:

 

This feature enables the HBG3 to pretend to have a near-instant "Fake GPS" receiver, whether or not it actually has GPS hardware attached.  This requires "Access Point" mode on WiFi, with an internet connection.  It uses that to get UTC Date/Time from a Network Time Protocol (NTP) server.  That, in combination with user-entered coordinates (which are saved), makes using a Nexstar/StarSense hand-controller much more pleasant.  smile.gif

 

If there actually is a real GPS receiver wired up, then information from it will replace the Fake GPS data for the session, as soon as the real GPS receiver gets sufficient satellite lock to provide data.  The OLED and push-button can then be used to save the updated actual coordinates for next time out.

 

Use v8.28 or newer firmware, or this test version of the code:  Attached File  hbg3.ino.txt   290.27KB   11 downloads

 

You can use the OTA Firmware Update to install the special test version, or wait for v8.28 to be released.
To access the special test version, first set a special variable in NVRAM on the HBG3:

 

   set ota.update.path /hbg3/ntptesting.bin

   save

   reset

   ota_update

 

Don't forget to then reset that setting after, so that future normal firmware updates can be acquired:

 

   set ota.update.path

   save

 

To use Fake GPS, first determine your GPS coordinates in degrees only.  Eg.   N45.35165 W76.04777

Ditch the N,W,S,E prefixes, replacing W and S with a minus sign:  45.35165 -76.04777

Google Maps and smartphones are among the ways to determine those coordinates.

 

Use the Serial/Telnet Debug interface on the HBG3 to enter/save these, like this:

 

    fakegps 45.35165 -76.04777

 

No separate "save" command is needed in this case.

You now have a Fake GPS, or will have as once NTP gets the Date/Time from the internet. cool.gif

 

During all of this, the GPS status display on the OLED uses indicators to show what kind of data is being displayed/used.


Edited by mlord, 19 December 2023 - 09:01 AM.

  • Rac19 likes this

#1034 Astro Andy

Astro Andy

    Explorer 1

  • -----
  • Posts: 60
  • Joined: 10 May 2021
  • Loc: SW UK

Posted 18 December 2023 - 05:54 PM

Nice, that worked for me and I see the NTP time indication. No GPS equipment connected and the OLED page is present.

 

Brilliant stuff, cheers. 


  • mlord likes this

#1035 mlord

mlord

    Cosmos

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

Posted 18 December 2023 - 11:25 PM

I have updated the OTA binary and source code again in the post above, to fix a boot loop with "Direct Connect" mode.


  • Astro Andy likes this

#1036 masi

masi

    Explorer 1

  • -----
  • Posts: 53
  • Joined: 09 Nov 2023
  • Loc: Öhningen, Germany

Posted 19 December 2023 - 04:08 AM

Okay, that code does exactly what the HBG3 already does.  You'll have to debug it further at your end.

Modifying the code to this, solves the issue with fRAM identification.

 

static void fram_setup (void)
{
  Wire.beginTransmission(FRAM_I2C_ADDR);
  delay(100); // added delay to make FRAM identifyed
  fram_detected = (Wire.endTransmission() == 0);

}


  • mlord likes this

#1037 Rac19

Rac19

    Soyuz

  • *****
  • Posts: 3,910
  • Joined: 05 Aug 2016

Posted 19 December 2023 - 06:17 AM

Use this test version of the code:  attachicon.gif hbg3.ino.txt   [UPDATED to v8.27d]

Installed and working well. I don't how many others find this useful but I certainly do. Thanks very much Mark.

 

One question, how is this disabled? invoke fakegps with no coordinates perhaps? I don't expect to need to turn it off in fact.


Edited by Rac19, 19 December 2023 - 06:25 AM.

  • mlord likes this

#1038 mlord

mlord

    Cosmos

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

Posted 19 December 2023 - 08:32 AM

One question, how is this disabled? invoke fakegps with no coordinates perhaps?

Exactly that.  Intuitive, isn't it!  smile.gif

Or, you can disable it but keep your entered coordinates, with this setting:

 

   set gps.location.force

   save

   reset

 

Setting any variable to "nothing" like that, reverts it to the "factory default" setting.

Or you could actually set this one to either 0 (zero) or false for a similar effect.

 

The Network Time Protocol (NTP) is "always on" regardless until the GPS gets Date/Time.

 

EDIT:  Speaking of which, don't forget to reset your HBG3 to use normal firmware updates:

 

   set ota.update.path

   save

 

Cheers


Edited by mlord, 19 December 2023 - 04:59 PM.

  • Rac19 and Astro Andy like this

#1039 Rac19

Rac19

    Soyuz

  • *****
  • Posts: 3,910
  • Joined: 05 Aug 2016

Posted 19 December 2023 - 03:00 PM

Exactly that.  Intuitive, isn't it!  smile.gif

....etc...

I think that you have answered a couple of questions that I forgot to ask.

 

1. When using a mobile hotspot, it (hotspot mode) can be turned off after a GPS fix is obtained.
2. Future releases will include the NTP feature.

 

Now I all need are clear skies and a suitable ISS pass to enjoy a hassle free Hibernation wake up (at dusk) to capture some images of the ISSsmile.gif.


Edited by Rac19, 19 December 2023 - 04:24 PM.


#1040 mlord

mlord

    Cosmos

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

Posted 19 December 2023 - 03:23 PM

I think that you have answered a couple of questions that I forgot to ask.

 

1. When using a mobile hotspot, it (hotspot mode) can be turned off after a GPS fix is obtained.

I'm not sure.  You'll have to try that and report back.

 

What I do know, is the hand-controllers seem to finish with the GPS after the first Alignment procedure is initiated.  So one can definitely shut down "the internet" at that point.  :)


  • Rac19 likes this

#1041 Rac19

Rac19

    Soyuz

  • *****
  • Posts: 3,910
  • Joined: 05 Aug 2016

Posted 19 December 2023 - 04:31 PM

I'm not sure.  You'll have to try that and report back.

 

What I do know, is the hand-controllers seem to finish with the GPS after the first Alignment procedure is initiated.  So one can definitely shut down "the internet" at that point.  smile.gif

The mount will be immediately aligned on waking from hibernation so I will try it out. It makes sense that GPS (real or fake) data should be read once only in a session. I expect cloudy nights for the next week  but will test when i get a chance.



#1042 masi

masi

    Explorer 1

  • -----
  • Posts: 53
  • Joined: 09 Nov 2023
  • Loc: Öhningen, Germany

Posted 19 December 2023 - 04:45 PM

 

Actually, does it work with this line instead of any delay:

 

  Wire.write(0x00);

dows not work with the line above

 

delay(37); is the lowest value when it starts working

 

Martin



#1043 mlord

mlord

    Cosmos

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

Posted 19 December 2023 - 04:58 PM

dows not work with the line above

delay(37); is the lowest value when it starts working

Okay, thank-you.  HBG3 firmware v8.28 will include the delay().

 

Cheers



#1044 mlord

mlord

    Cosmos

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

Posted 19 December 2023 - 09:37 PM

Here is version v8.28 of the Arduino ESP32 source code for this project:  Attached File  hbg3.ino.v8.28.txt   291.74KB   17 downloads

  • New "simple_mode" of operation: wire 50K pull-down and 100K pull-up on ESP32_WIFI_MODE_PIN.
  • Improve I2C device detection for FRAM modules.
  • Use original floating point lat/lng values for gps.location.lat and gps.location.lng values.
  • Add new "fakegps" command to emulate a GPS receiver:  fakegps dd.dddddd -dd.dddddd
  • Add missing "help" info for the new "send" command.
  • Add new "baud" command to enable setting faster baudrates on the SerialDebug port.
  • Add support for NTP date/time use while GPS waits for date/time fix.

The new Fake GPS feature is written up here:  https://www.cloudyni...2#entry13139022

It deserves a look, especially by anyone still using hand-controllers for alignments.  The Network Time Protocol (NTP) stuff is mainly in support of Fake GPS, but also gets used with a real GPS when doing Restore Location.

 

"simple_mode" gives me a convenient auto-detect method for when I wire up a special-purpose HBG3 as, Eg. a dedicated standalone Focus Motor controller.  No more having to build special firmware for that application.

 

I am contemplating increasing the default SerialDebug baud rate from 115200 to 230400 in the future, as it reduces overhead when capturing packet traces.  But not yet.  Meanwhile, the new "baud" command is there for experimenting with.

 

Flashable binaries (with Ethernet support) are in the usual places, including Over-The-Air (OTA, using WiFi) Firmware Update binaries for both the HBG3 and the AIO project.  Fully pre-configured and patched HBG3_Arduino build packages are also available from the links at https://rtr.ca/hbg3/

 

Note: Anyone doing an OTA update will now receive version v8.28+.  Same as v8.28, but with a minor improvement to the SerialDebug command parsing.  No other changes, perfectly good to use.


Edited by mlord, 20 December 2023 - 01:39 PM.

  • Astro Andy likes this

#1045 mlord

mlord

    Cosmos

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

Posted 20 December 2023 - 11:27 AM

The Network Time Protocol (NTP) stuff is mainly in support of Fake GPS, but also gets used with a real GPS when doing Restore Location.

Now I just need someone (volunteers?) to figure out how to pass the NTP Date/Time to a Beitian GPS receiver, so that it can speed up the "time to first fix".


Edited by mlord, 20 December 2023 - 01:41 PM.


#1046 Nemo51

Nemo51

    Surveyor 1

  • *****
  • Posts: 1,694
  • Joined: 25 Aug 2021

Posted 20 December 2023 - 11:43 AM

Help, please. What does idle mean?

Attached Thumbnails

  • IMG_1694.jpeg


#1047 Astro Andy

Astro Andy

    Explorer 1

  • -----
  • Posts: 60
  • Joined: 10 May 2021
  • Loc: SW UK

Posted 20 December 2023 - 12:08 PM

Help, please. What does idle mean?

Use the search for idle and the answer is there...no connections.

 

https://www.cloudyni...lay/?p=13115424


Edited by Astro Andy, 20 December 2023 - 12:09 PM.


#1048 Nemo51

Nemo51

    Surveyor 1

  • *****
  • Posts: 1,694
  • Joined: 25 Aug 2021

Posted 20 December 2023 - 12:16 PM

Use the search for idle and the answer is there...no connections.

 

https://www.cloudyni...lay/?p=13115424

Thank you. I did search and found those posts, but only conclusions without solutions. I’m old, and have had eye surgery. 
 

Three weeks ago it worked great. Suddenly I have idle in direct and access point modes, using firmware .28 which it loads wirelessly. I have tried an evo and slt mount to the same effect. 
 

I have a non oled version with earlier firmware, which connects to both mounts. 
 

help appreciated, with factual bases, not conclusions. 



#1049 Astro Andy

Astro Andy

    Explorer 1

  • -----
  • Posts: 60
  • Joined: 10 May 2021
  • Loc: SW UK

Posted 20 December 2023 - 12:19 PM

 

  • Add new "fakegps" command to emulate a GPS receiver:  fakegps dd.dddddd -dd.dddddd

It quotes 2.6 digits here but during testing it was 2.5 digits. Can up to 6 be held for increased accuracy?

 

fakegps 45.35165 -76.04777


Edited by Astro Andy, 20 December 2023 - 12:23 PM.


#1050 Astro Andy

Astro Andy

    Explorer 1

  • -----
  • Posts: 60
  • Joined: 10 May 2021
  • Loc: SW UK

Posted 20 December 2023 - 12:28 PM

Three weeks ago it worked great. Suddenly I have idle in direct and access point modes, using firmware .28 which it loads wirelessly. I have tried an evo and slt mount to the same effect.

https://rtr.ca/hbg3/history.html has the updates. Mark updated the OLED status text to be more descriptive. 

Attached Thumbnails

  • 1000013503-01.jpeg

Edited by Astro Andy, 20 December 2023 - 12:32 PM.

  • mlord likes this


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