Started by Stormy_dll 5 years ago19 replieslatest reply 5 years ago210 views

Hey everyone. We are working on laser simulator of firing. 

Our embedded system consists of:

1. GSM module sim800.

2. 6 digital photoreceivers, connected with control board via I2C bus. 

3. Control board with several power lines and MCU Samr21 with embedded 2.4 GHz transceiver. 

4. GNSS receiver gy-neo6mv2.

The problem that we can not solve for a months is that GNSS does not fix coordinates if the photoreceivers are connected. If they dont, gps works good. 

The photoreceivers cable is about 3m length, consists of 4 wires – SDA, SCL, GND, 3.3V. We think that this cable works as a large antenna, but we don't know what to do. 

Feerite filter, capacitors, integrated filters as a solution has been tried already. 

The electronic block has size 130mm x 90mm. The boards is connected to e.o. via molex connectors and wires. 

Any thoughts would be appreciated.

[ - ]
Reply by DilbertoNovember 4, 2019

hi, Stormy_dll!

IMHO, this type of problem may be associated with power supply issues.

Have you measured the current consumption with and without sensors attached?

Have you connected one sensor at a time and verifying what happens?

Does your PCB have a ground plane? This is important in any case but fundamental when dealing with RF.

Are the power supply rail for the GPS module decoupled from the ones for the remaining circuit?

I hope this helps

Cheers! And good hunting!

[ - ]
Reply by Stormy_dllNovember 4, 2019

Hi, Dilberto!

Thank you for you reply!

1. I have double-checked the gps power supply with and without sensors. Both is perfect 3.3V with about 10 mV deviation. 

Our power tree: 

Dual 18650 li-ion battery -> 4A buck converter to 4 V. Then we have LDO 3.3V for GPS and decoupled i2c bus using ADuM1250 IC and transformer and also LDO. 

6 sensors consumes additional ~40 mA while the rest of the electronics consumes ~200 mA average current and up to 2+ A max. So i guess sensors don't affect the operation of a power tree.

2. Yes we have tried to connect one or two sensors. It works worse and worse with each sensor connected.

3. GSM board and control board are 4-layers and have a ground planes. The gsm board gy-neo6mv2 is 2-layers as i can see and also has a ground plane.

The sensor consist of analog and digital boards and both have no ground planes. 

4. Sensors are decoupled. Is it a good idea to decouple GPS board, not a sensors? 

Anyway i guess a noise comes from sensors goes through transformer capacity easily because of high frequency

[ - ]
Reply by stonethrowerNovember 4, 2019

Hi there,

From your description I see the possible trouble with I2C cable lenghth, in your case 3m may cause significant signal degradation since I2C is meant to be short length lines, ballpark an order of magnitude shorter (30 cm, not 3 m). Signal degradation due to capacitive load of the cable and all I2C slaves may be so severe to actually stall the CPU especially if you configured your NVIC controller to have the highest interrupt priority.

I would definitely use some of I2C line extenders (amplifiers) for that length of cable.From SAMR21 datasheet CPU can handle up to very high I2C speeds >3MHz, Your cable is definitely no-no for such speeds. I assume you are using "normal" 100kHz or maybe higher 400kHz I2C clock, but again I doubt that 3m cable is adequate for 400kHz.

I also assume (no harm asking, though) you have given different interrupt priority levels for SERCOMs handling I2C and comm. for GNSS. It may happen that same level of interrupts of both I2C and GNSS arriving at the same time stall the CPU, cause the NVIC tries to handle many signals at the same time with the same priority level.

Hope it helps you a bit.

[ - ]
Reply by Stormy_dllNovember 4, 2019


Thank you for your reply.

I agree that 3m I2C could create a troubles. 

Some information about I2C and UART: 

1. I2C clock is 100 khz.  We had a big troubles with I2C bus untill we put a pull-up resistors at each sensor. After that I2C bus was always working perfectly. I2C generates interrupt with default priority each 20 ms. The code via this interrupt executes contains a little logic and executes in tens CPU clocks.

2. UART is configured with 9600 baudrate. UART generates interrupt with default priority too and also executes in tens CPU clocks. 

You have presented a great thought, i will do my best to check your idea. I will try to turn the I2C off totally and then check GNSS system via GSM with sensors connected. 

Will keep you up to date. 

Edit: I have compared gps reception with and without I2C data exchange both with connected sensors. The results are the same. 

So the program is ok I guess.

[ - ]
Reply by CustomSargeNovember 4, 2019

I'll second Dilberto, power is the first place I'd look.

Second, you're not giving the entire signal layout. Is photoRX I2C alone? How long are ALL the cables? How about shielding, both overall and paired?

Use your o'scope (you DO have one...) to monitor GPS signals when adding photoRX one at a time.

You've got interaction and/or interference - methodical isolation is warranted.

Good Hunting  <<<)))

[ - ]
Reply by Stormy_dllNovember 4, 2019

Hi CustomSurge!

Thank you for your reply!

1. Please take a look at the information about power rails in the reply to Dilberto. 

2. We have a cable with 6 photoreceivers connected via 0.5m cable. So the total length is 3m. 

Shielding sensors using metal box helps. But due to design features we cant shield the whole sensor cable, because we have to cut the cable to place the sensor. Shielding only the wires and connecting shield to the GND at sensors doesn't help.

3. Unfortunately, we cant monitor GPS signals on the oscilloscope due to its very high frequency and very low signal level. The only information we can use is data received via NMEA protocol (UART). 

[ - ]
Reply by CustomSargeNovember 4, 2019

I'll suggest and have my betters verify/correct that shielding should be attached to ground Only at the system end. The shielding is not connected anywhere else. "Ground loop" is the term I've heard for problems if it isn't that way. Like RF, they're both dark magic I don't understand.

Good Hunting  <<<)))

[ - ]
Reply by Stormy_dllNovember 4, 2019

Yeah, i`ve heard that too. By the way, the system "end" is the last sensor or the control board? 

[ - ]
Reply by CustomSargeNovember 4, 2019

It's whatever is the convergence point of the sensor cables. If I have 5 temperature sensors going to a multiplexer / ADC, the mux / ADC is the only ground for all 5 cable shields. Shields aren't connected anywhere else.

[ - ]
Reply by mr_banditNovember 4, 2019

ALWAYS have a oscope probe on the power line. A good way to find these kinds of problems. Also weird reset cases.

Do NOT use a normal meter - they integrate && you will miss the bad signals. OK (mostly) for measuring current draw, but not voltage.

A simple technique is to add one sensor at a time - most useful when you don't have an oscope. You are in REAL trouble if the failure occurs with only 1..2 sensors attached. Basically, what Dilberto && CustomSarge said...

Do the photosensors work by themselves?

Basic law of debugging: simplify, simplify, simplify.

Please keep us informed...

[ - ]
Reply by Stormy_dllNovember 4, 2019

Hi mr_bandit! 

Thank you for your reply! 

1. Please take a look at the information about power rails in the reply to Dilberto. 

I have a 1 ghz band oscilloscope, its good enough to monitor power line i guess. 

2. Sensors work perfectly. For about year of exploitation there were no troubles with I2C bus work. 

[ - ]
Reply by mr_banditNovember 4, 2019

Create an I2C cable with the 6 sensors && make it as short as you can - under a foot would be good. You could put all sensors on a protoboard with a short cable (6-inch or so).

The note you had to put pullups at each sensor is a big clue you need an I2C bus extender chip.

see https://www.analog.com/media/en/technical-documentation/data-sheets/16941fa.pdf

see http://www.ti.com/lit/ds/symlink/pcf8574.pdf

You have not indicated the I2C signals at the sensors look good. The fact adding sensors increases the problem is a clue you don't have healthy bus signals. I suspect the signals at the sensors are not up-to-spec, which matches your report the more sensors the worse the behavior.

You may need to re-think your approach. For example, pair each sensor with a cheap micro (like an atmel or (ghod forbid) a pic) and use an RS486 multidrop bus to the main micro. good candidates include ATtiny2313A and ATtiny4313

something like http://ww1.microchip.com/downloads/en/DeviceDoc/8246S.pdf (summary)

full: http://ww1.microchip.com/downloads/en/DeviceDoc/doc8246.pdf

Yes, this increases cost by a few bucks. But consider the NRE y'all have burned through vs the number of units you expect to make.

Keep banging the rocks together!

[ - ]
Reply by Stormy_dllNovember 4, 2019

I2C signals looks fine using oscilloscope. 

Anyway, when I tried to disable I2C bus from the master (which is also connected to GNSS), the situation isn't changed. 

So I2C bus as I could see doesn't affect the GNSS. 

Anyway you are absolutely right, we have made a mistake when decided to use I2C bus for such cable. One of the next steps is place differential transceivers for a bus. 

Thank you for your help! 

[ - ]
Reply by iansNovember 4, 2019


I would echo the other replies in that this sounds like a power and/or ground issue.

One other thing to check is your GPS antenna - as you know the GPS signal is very low power so your antenna circuit has to be well designed.The best place for your antenna is right next to the GPS receiver but if all your other circuitry is also right next to it then you may get EMI around that area which will impact your GPS signal quality.

What sort of antenna are you using? Where is it in relation to your GPS receiver?

[ - ]
Reply by Stormy_dllNovember 4, 2019


I am using external active antenna. The length of coaxial cable is about 50 mm. The pcb trace is 50 ohm as well as rf connector. So it's okey. 

Yes by the way position of the antenna in the electronic block is important as we can see. Today i have found the best position for my antenna, but still sensors connection lowers signal/noise ratio significantly. I think its EMI/ground troubles, oscilloscope shows perfect 3.3V voltage on GPS module. Maybe we just can't see so high frequency noise on the gps power. 

[ - ]
Reply by iansNovember 4, 2019

Okay, how close to the GPS receiver is the RF connector? Have you had the antenna characterised to make sure it is properly matched to your circuit for best performance? Is the ground plane around this part of the circuit flooded and stitched?

The other question would be what is the GSM module doing at this time? We have seen problems using 2-layer boards for GSM where there is noise induced on the ground plane when the GSM is active. Can you power off/remove the GSM to make sure it is not having an impact?

[ - ]
Reply by Stormy_dllNovember 4, 2019

RF connector placed in ~10 mm near GPS module. It's a completed gps board that we have bought. 

I was also suffering for a months from GPS signal quality when instead of matched rf connector we just solder coaxial cable to the board :d So now we are using completed solution (module board with rf connector and antenna in a set). 

GSM board is 4-layers and has a ground plane. 

Anyway we have connected MCU debugger for monitoring GPS with unconnected GSM, the situation is the same. 

[ - ]
Reply by DilbertoNovember 4, 2019

Hi Stormy_dll!

The GPS you're using has a high-quality Ublox module, but have you considered to replace the module?

Even a high-quality part may have performance issues and, once the problem seems to be associated with the signal to noise ratio, it makes sense to guess that the problem may be caused by performance issues.

I'm rooting for you!

[ - ]
Reply by Stormy_dllNovember 4, 2019


We have tried several GNSS receivers: sim68m, n30b etc. 

The only problem of u-blox module is that it's not supporting glonass receiving. 

Anyway for now it's a best choice for us, because of it has the external active antenna in a set=) 

After I have changed the position and rotation of the antenna, GNSS started to work even with connected sensors. 

But why sensors lowers signal/noise ratio is still a question. 

Now I'm going to monitor quality of GNSS signal for a week and then to make a decision.

Thank you for your help Dilberto!