Sunday, July 28, 2019

Programing TP5 (time pulse) on the Ublox NEO-7M via Arduino

I needed to program the time pulse (TP-5) output on a Ublox NEO-7M GPS module, that is strait forward with the U-center software (connect serial and power betwen PC and GPS module), only problem is that software only runs on Windows and I'm more a Linux user.

The module can also be programed via the Arduino or any device with a serial port as long as you know the u-blox programing specification/protocol.
For the correct command to be sent you can either read the u-blox programing/documentation manual and calculate/generate the string plus the crc or you deploy U-center software on Windows, take the hex output for your needed output and program that on Arduino.

I started to read the specs and try to recreate the command but half way trough it just decided to boot a Windows and deploy U-center and then get the needed outputs, example here:

The two Hex lines are is in the bottom right.

Most of the details on how to accomplish this here were taken from a nice tutorial from "iforce2d" channel at:

 https://www.youtube.com/watch?v=ylxwOg2pXrc

Have a go there, it's very well explained from someone who really knows what is doing.... not my case :)

The output of some of the frequencies tested with the module directly at the "PPS" output pin (not the internal blinking LED).

 2Mhz
 2.5Mhz, all the ones that are not integer division of 48Mhz appear with some jitter.
 24Mhz is not the most square, also due to probes.
The module used is one like the above.
Vcc is 5v, txd and rxd to Arduino softserial 3,4 and PPS is the output.

In the code are 2Mhz, 2.5Mhz, 10Mhz and 24Mhz output examples, all with 1Hz timepulse if not enough satelites to provide a precise frequency are avaiable.
If other frequencies are needed I suggest installing U-center and then generate the needed Hex code and insert it on the code bellow.

The code also includes one output for I2C LCD, serial and LED to indicate status, it can be removed, if you just need to program the module. I added it as part of some experiemtes, don't expect to be perfect was mostly for troubleshooting some GPS modules I have.

Arduino code bellow:
/////////////////////
// programing of the u-blox 7m module from Arduino for timepulse TP-5
// hex was taken from u-center software configuration view
//
//
// plus, flashing LED connected to pin 10 indicates when enough sat's in view
// u-blox module to connect o 3 and 4 for using soft serial of Arduino
// CT2GQV 2019 mixing multiple libs and examples.

#include
#include
#include                           
#include  
LiquidCrystal_I2C lcd(0x27,2,1,0,4,5,6,7);

const char UBLOX_INIT[] PROGMEM = { 
 
// the actual programing string, uncoment for the one needed. 10Mhz, 2.5Mhz, 24Mhz or 2Mhz
// any frequency not integer divide of 48Mhz will have some jitter since module reference is 48. Best use is for 24 or 2 Mhz

/*
 // CFG-TP5 1Hz / 10Mhz sync
  0xB5, 0x62, 0x06, 0x31, 0x20, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x80, 0x96,
  0x98, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x6F, 0x08, 0x00, 0x00, 0x7E, 0xA8,
*/

/*
  // CFG-TP5 1Hz / 10Mhz no sync 50ms cable delay
  0xB5, 0x62, 0x06, 0x31, 0x20, 0x00, 0x00, 0x01, 0x00, 0x00, 0x32, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x80, 0x96, 0x98, 0x00,
  0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x6F, 0x00, 0x00, 0x00, 0xA8, 0x08,
*/

/*
  // CFG-TP5 1Hz / 24 Mhz no sync 0ms cable delay
  0xB5, 0x62, 0x06, 0x31, 0x20, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x36, 0x6E, 0x01,
  0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x6F, 0x00, 0x00, 0x00, 0x6D, 0x8D,
*/

/*
  // CFG-TP5 1Hz / 2.5Mhz no sync 50ms cable delay
  0xB5, 0x62, 0x06, 0x31, 0x20, 0x00, 0x00, 0x01, 0x00, 0x00, 0x32, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xA0, 0x25, 0x26, 0x00,
  0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x6F, 0x00, 0x00, 0x00, 0xE5, 0x21,
*/

  // CFG-TP5 1Hz / 2 Mhz no sync 50ms cable delay
  0xB5, 0x62, 0x06, 0x31, 0x20, 0x00, 0x00, 0x01, 0x00, 0x00, 0x32, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x80, 0x84, 0x1E, 0x00,
  0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x6F, 0x00, 0x00, 0x00, 0x1C, 0x1E,


/* 
  // UBX-CFG-TP5 parameters (not fully complete)
  0xB5, 0x62, // header
  0x06, 0x31, // time pulse get/set
  0x20,  // lenght 32
  0x00, // tpIdx time pulse selection = 0 = timepulse, 1 = timepulse2  (U1 Char)
  0x00,  // reserved0 U1
  0x01, 0x00, // reserved1 U2
  0x00, 0x32, // antCableDelay ns
  0x00, 0x00, // rf group delay I2
  0x00, 0x90, 0xD0, 0x03, // freqPeriod
  0x00, 0x40, 0x42, 0x0F, // freqPeriodLoc
  0x00, 0xF0, 0x49, 0x02, // pulselenRatio
  0x00, 0x60, 0xAE, 0x0A, // pulselenRatio
  0x00, 0x00, 0x00, 0x00, // userConfigDelay ns
  0x00, 0x77, 0x00, 0x00, // flags - page 135 u-blox 7 Receiver Description Including Protocol Specification V14.pdf
  0x00, 0x48, 0x65,
*/ 

};

int SATLED = 10;  // for showing we have satelites

TinyGPS gps;
// SoftwareSerial ss(4, 3);
SoftwareSerial ss(3, 4);
int sats = 0 ;

void setup()

  lcd.begin(16, 2);                           // LCD set for 16 by 2 display
  lcd.setBacklightPin(3,POSITIVE);            // (BL, BL_POL)
  lcd.setBacklight(HIGH);                     // LCD backlight turned ON
 
  lcd.setCursor(0, 0);                        //
  lcd.print("Booting...");    
  ss.begin(9600);

  pinMode(SATLED, OUTPUT); // to indicate we have enough satelites
  digitalWrite(SATLED, HIGH);
  delay(2000);
  digitalWrite(SATLED, LOW);

// actual u-blox 7m programing 
   for(int i = 0; i < sizeof(UBLOX_INIT); i++) {                       
    ss.write( pgm_read_byte(UBLOX_INIT+i) );
    delay(5); // simulating a 38400baud pace (or less), otherwise commands are not accepted by the device.
  }
// ends here  
  
  Serial.begin(9600);
  Serial.println("= sent init string to GPS =");
  lcd.setCursor(0, 0); lcd.print("NO DATA   ");
}

void loop()
{
  bool newData = false;
  unsigned long chars;
  unsigned short sentences, failed;

  // For one second we parse GPS data and report some key values
  for (unsigned long start = millis(); millis() - start < 1000;)
  {
    while (ss.available())
    {
      char c = ss.read();
      Serial.write(c); // uncomment this line if you want to see the GPS data flowing
      if (gps.encode(c)) // Did a new valid sentence come in?
        newData = true;
    }
  }

  if (newData)
  {
    float flat, flon;
    unsigned long age;
    gps.f_get_position(&flat, &flon, &age);
    Serial.print("LAT=");
    Serial.print(flat == TinyGPS::GPS_INVALID_F_ANGLE ? 0.0 : flat, 6);
    Serial.print(" LON=");
    Serial.print(flon == TinyGPS::GPS_INVALID_F_ANGLE ? 0.0 : flon, 6);
    Serial.print(" SAT=");
    Serial.print(gps.satellites() == TinyGPS::GPS_INVALID_SATELLITES ? 0 : gps.satellites());
    sats = gps.satellites();
    lcd.setCursor(0, 0); lcd.print("Satelites:");lcd.print(sats);
    if (sats >= 3){digitalWrite(SATLED, HIGH); delay(20);digitalWrite(SATLED, LOW );};
    //if (sats < 3 ){digitalWrite(SATLED, LOW );};
    Serial.print(" PREC=");
    Serial.print(gps.hdop() == TinyGPS::GPS_INVALID_HDOP ? 0 : gps.hdop());
  }
 
  gps.stats(&chars, &sentences, &failed);
 if (chars == 0)
    Serial.println("** No characters received from GPS: check wiring **");
}


////////////////////
..code ended.

Have a nice week!

Sunday, June 23, 2019

Simple 10Ghz frequency counter #2

After previous post on the simple 10Ghz frequency counter # 1, here's another option that will be cheaper than buying a full featured 10 Ghz range frequency counter. Again, different functionalities, this way shown it's just to provide an alternative since Ghz range frequency counters are normally very expensive.
This method involves using an old wave-meter.
Now a days you can find some wave-meters ate reasonable prices, in the range of less than 60Eur like this one from HP that I got recently:


It covers roughly 8 to 12Ghz, it's an HP X532B. Diferent models have different ranges, I wanted 10Ghz so this is the appropriate one.
The wave-meter by it self is not enough to measure a frequency, you will need waveguide transition from coax and a waveguide detector. You can build these two components quit echeaply and they will still work, not lab grade but enough for amateur use.


Bellow the ones I build using copper pcb, not an optimal material but will do:
The waveguide detector part:

Most critical measurement is the distance from the diode to the reflection plate on the back (opposite to the front facing side), what I did was measure 1/4 wave from the end and then adjusted the backplate to biggest signal.

View from the back still not covered:
For the flange mount and bolts placement I just used the template of the wave-meter it self but dimensions are pretty much standard.

For the coax to waveguide transition, same method:

 Signal entrance view:




The antenna can be DC connected to ground or open, I preferred the open option in case I need to provide dc over coax.
Basically I used the pin of the sma connector plus a bit of wire to make the correct wavelength
Again, this is not a calibrated devices but on the overall usage it does not make a difference, as long as we can place a signal at the entrance of the wave meter and detect it on the output we are good to measure frequencies.
The only possible downside is if the waveguide transition block loads the circuit we are trying to measure shifting it's frequency, anyhow the actual frequency after load will be measured. 


I used a Russian D405B microwave mixer as detector since was a cheaper alternative (around 1Eur each plus shipping) to 1N23C and 1N21 that are commonly used in this type of application. The diode arrives in lead sealed container, nice touch, no microwaves will "touch" the diode until is unwrapped.



Bellow a test of the diode with a microamp meter


 At this point if you want to see if your diode works, just cook something on the microwave and while it's running place the diode near the door, should see some deflection on a microamp-meter, you can also use a DMM on milivolt scale.



Dimensions are only critical if you need max optimization.

Now on to measurement:
Keep in mind that this method is not as simple as connecting cable to a regular frequency counter and check the result, you need to observe the output value of the detector and look for very small dips on the output, you need to go really slow in order to find it since it's very sharp and small, it's good if you know the ballpark frequency, otherwise it can be very boring rotating the wavemeter knob back and forth until found since the know is quite de-multiplied.

Same values I measure:

 The dip value above
 The frequency on the dial
and the "normal" value at the signal output.

Bellow the test setup:
 I used my home-brew signal generator for testing and validation

Another view from the top knob:




I build recently a millivoltmeter where I added a blinking led if measured value had over 10% change in the average result so I could rotate the knob faster and just look a the led blink to find the dip. That made my life easier when checking for the dip.

It's the led marked "VAR" in the image bellow

 I will post in the future more information on this millivoltmeter.

Meanwhile, have a nice day.











 

Thursday, June 13, 2019

Simple 10Ghz frequency counter #1

After previous post on the 10Ghz generator we need to measure it.

The following method is probably the cheapest you could find for 10 Ghz measure, still not dirty cheap but considering the price of a real counter on a much lower magnitude order.

This is nothing more than an LNB for satellite TV feeding a UHF frequency counter module.

Circuit:

You inject 12V onto the LNB, DC block it and feed the counter input.

The LNB:

The counter:

...mine is a VFD display module placed in a box with additional crystal testing circuit you have also LED versions (search for PLJ-8LED-H RF Signal Frequency Counter).

To calculate your signal input frequency just sum 9.75Ghz

Keep in mind that this will give you an approx frequency since on most of the LNB's the 9.75 Ghz LO is far from precise. The ones with PLL are a bit more stable.
Anyhow it will let you know if you are in the ball part.


The oscillator feeding the signal was the one from previous post placed in front of the LNB with a piece of wire as antenna:


Total cost will be around 10Eur for the counter plus 15Eur for the LNB and additional components, compare that even for a second hand HP or EIP... ok compare just the price...


Have fun




Monday, June 10, 2019

Simple 10Ghz oscillator with FVC99 hybrid VCO

I wanted to test 10Ghz band, more like a challenge than for any practical application, so started some experiments.

One of the first builds was an oscillator, it's a simple module out of the shelf with just a companion pot for tunning.

The module is an FVC99 hybrid VCO and more data available here:
It's major advantage is price, something less than 10Eur. Cheaper that any other sort of VCO (except probably the cheap motion detector modules that I will show in the future).

Mine is covering 9.5GHz to 10.326 Ghz


I am lucky to have a Ghz capable frequency counter, in a future post will show how to measure in some other ways (cheaper).

Without any care on the output connection it measured -15dBm to -4 on the full frequency range.

Schematic:
So nothing more than power to the module and a pot doing resitive divider connected to the tune terminal of the same module (VT). It's 5V on the picture but I used a 6V regulator.

Keep in mind that i mistakenly connect the 78X regulator on opposite direction.. in case you follow the wiring on the picture....still thinking how I manage to do that the first time...guess i'm getting old.

 ...frequency calibration is more in the "around here" mark than any precision device. Enough for playing around.

These electrical installation boxes/housings are perfect for this type of assembly. just add a piece of pcb.

Have a nice day!






Sunday, June 09, 2019

AC panel voltmeter convertion to DC

Well, this is the first post of 2019.




Since the start of the blog the idea was always to document some of my projects and also as a means that others can be motivated to build something.
This would e a win win situation, the more people building the more need for components so the more shops would keep open since lately the tendency is for hobby electronics to decline. Also I would keep information on my project that could be handy when I have to fix them since I'm not good on taking notes.

Said that, here's a small conversion of a 250V AC panel voltmeter to 25V DC.
The schematic is nothing more than a series diode (using one of the existing from the original PCB) with a resistor and a variable trimmer in series with moving coil meter. The original schematic (for AC) is seen on the background.
Calibration was just using a 9V battery and setting the trimer to read 9V, (90V AC on the original scale). Not critical here since I just wanted a means of checking if one of my DC power supplies was outputting the selected voltage.









Have a great one!



 

Sunday, December 16, 2018

12 Months, 12 projects and some other posts.

In the first post for this year (2018) I wrote:

"...Happy New Year!
I'll try this year to post more project's, (at least one for each month) and some more simple ones in the middle, that including the failed experiments (I do have them). ..."

I managed to reach the set goal with my previous post (the 200 W 30db attenuator), still, posted none about failed experiments (there were).... anyhow there's still some days left to the end of 2019....


The posts this Year, (in reverse date order), so far, were ("P" is for project):

 P - 200 W 20/30 dB attenuator with 100 Ohm / 30w resistors

  - Inside Trimble 65256 10 Mhz TCX Oscillator

  - Stand for the JBC T245 - AOYUE 2663B

P - Skylab SKM52 - C&Q 84 - GPS module

P - New AD8307 power meter

  - New RF frequency generator for the shack

  - Park Air Electronics Model 2100 DIP switch settings

P - Back to the future - Arduino DCF77 transmitter

P - Teensy 3.6 + Si5351 connection and code

P - Teensy 3.6 + 2.8" TFT LCD Display SPI Serial 240*320 ILI9341 connection and code

P - MIC5205 (LB30, KB30) Low noise regulator, increasing voltage output

P - ADS-B In-line amplifier experiments and bias T for 1 Ghz

  - Mains power meter and rig energy consumption.

P - Bench power supply ( part II ) 

P - JBC T245 / C245 Iron tip controller

  - Insulated, Stackable Banana Plug - BU‐31104 - 4mm

P - Mini paint booth

P - RTL-SDR Dongle interference shield/filter


... to be honest I have more projects done than the posted ones but have being lazy in publishing them.

Have a great weekend!



Saturday, December 15, 2018

200 W 20/30 dB attenuator with 100 Ohm / 30w resistors

Between buying a 200 W probe/head for the power meter, a pre-made 30dB attenuator or making this project I chose the last option, it will not have the same frequency range but it's a lot more fun and a little cheaper . This attenuator is a nice way of extending the range of my existing 2 W power head URY-Z2 until the 200W mark. I wanted 200 W because in the future I need to test the FT-102 capable of that value.

The end result for the impatient:




The main schematic for the 20dB part is bellow. I added a after a 10 dB attenuator on the output, that was made with smaller resistors since it just needs to handle part of the final 1.7W (see further down the power distribution in the attenuator).

Keep in mind that the previous schematic only handles around 80 W if using 30W resistors. Most of the power is burnt in the first shunt.
A simple test layout diagram:

 The attenuator is only composed of 100 Ohm resistors (cheaper than the 50 Ohm ones on the flea bay) with the two terminals isolated from ground, so it was nice exercise to calculate and attenuator under this limitation.

 In previous setup and at 50Mhz, the attenuation obtained:

Not bad since the calculated value it's not exactly 20 dB.

The power dissipation calculation:


(addendum: just realized the power on the first shunt is miscalculated, should be 100W on the 100Ohm resistor and a total of 66W on the series 100 ohm with the 2 parallel 100 ohm)
The X marks the resistors that will be under power at an input of 200 W so the 100 Ohm (on the input, left side of the first shunt) taking 80w (100W is the correct value, see addendum) is now composed of 4 resistors, capable now 120W dissipation in total.

..and are the 4 ones diagonally oriented on the left top.

For the ground plane I used copper plate with 0.6mm tick and it had to be partially soldered in the oven, the iron just could not make it, then on the final assembly the iron just had to do the final touch.





Final assembly inside view:
The end 10dB attenuator added is the "mesh" on the lower side of the picture/box.

For the final 10dB also a PI attenuator was chosen with these values: on the first and on the end shunt: 4 x 470 Ohm all in parallel with 1x 560 Ohm . For the series element: 3 x 220 Ohm all in parallel with 1x 2K7 Ohm resistor.


I include glued to the box a chart with the output value in function of the final attenuation, the measured one at 50Mhz (29.39 dB) and the calculated 30dB, this way if I don't set on the power meter the correction I just look at the table:






The VNA pass:

..still need to validate with more accurate power meter than the AD8307  from my homemade "VNA" and with a proper reference set, never the less looks OK for the type of construction involved.

So far I only tested with 100 W on the input, gets only mild warm for quick tests, for extended periods it might need to spread the resistors a little more and possibly include some thermal paste and better heat sink.

Approx cost of the project was as follows:

- N plugs: 3.20 €
- 30W Resistors (18) + 1/4W resistors : 12.00 €

- Box: 7.00 €
- Copper plate: 3.00 €
- Solder/paper/ink: 1.00 €

# Total #: 26.20 €


Have a great day!




















The schematic changed