General troubleshooting and bug fixes

Hi

I'm working on a project, that uses many Arduino boards and refurbished PCs.
The issue I am facing is with MPU 6050 components; these have been switched out multiple times, as well as Arduino boards, and different versions of the sketches.

They are connected to the PC(s) via USB.

I am trying to figure out what the problem is. It seems that data isn't always being recorded, or it gets "stuck". I've tried to do a soft reboot of the board via the sketch, which works but causes a lot of USB disconnects, and then ultimately freezes.

Between the 2 boards and the PC, it has formed a love triangle (boards talking to each other, talking to the PC, PC talking to the boards).

In one of the previous versions of the code, there were FIFO overflow messages.

However, I do not get this issue with my own dev machine. It's the same code, libraries and process, except my PC is significantly better (Win11 vs 10, 64GB RAM vs 16GB, AMD Ryzen 7 vs Intel i5, RTX 3060 vs iGPU).

Could it be due to faulty boards/components, wiring, resources or even USB speeds?

Let me absolutely clear. This isn't about code, it is about general troubleshooting, specifically with hardware; wiring, USB speeds, etc.

Hmm I am pretty sure windows 10 can handle mpu6050s, depending on how many PCs we are talking about here.

I don’t know why but one thing I’d make sure to cross check here is that the baud rate in your code is same as baud rate in console. Either that or there’s something wrong with wiring if nothing wrong with code.

Hi

So it's essentially 1 MPU 6050 for each machine, and I was told they're all the same specs (but I think that isn't the case).

The code uses 2 serials with different bauds, and I've tried switching between the 2 on the serial monitor dropdown, and it hasn't made a difference.

Basically there is input and output (hence the 2 serials).

Funnily enough, the only PC apart from my own that runs the MPU well is the one that cannot recognise (and thus attached) the second Arduino, so it handles input only (I assume since it cannot find the "second device", it just silently fails).

Not recognising an arduino could b a device manager issue or boot loader.

this may be stupid to ask but why do you need two different bauds?

There are 2 Arduino boards per PC.

IoT sends input from MPU, encoder, and other devices to the PC, whilst also sending a signal to the Every board (for LEDs).

PC also sends a signal to LEDs (or one in particular) on the Every board.

I've been told that 2 serials/bauds are needed to "separate the signals out".

But, as I said, it works perfectly well on my PC, which is a lot more modern and higher spec that these other PCs, as well as being rewired by myself.
I think the code is sound.

What I am trying to figure out if it is the code, or if these PCs cannot handle the USB traffic, or if the Arduino and components haven't been wired up correctly (because I have caught a few of these mistakes), or even if these components are so low quality/fakes it is causing issue.

@quin452 To get us all on the same page, so we can answer with better than just generalities, could you please read:

And then get back to us, with a new post in this thread for continuity, providing:

  • project diagram (block diagram showing general device layout, connections between components, power arrangements)
  • schematic of a typical node, showing all component part numbers, etc. as well as detailing any irregularities between one installation and the next
  • sketch running on a typical installation, and any caveats about changes between one installation and the next

Seriously, we can hand wave for hours, but the information I’ve asked for is probably essential to truly help you.

I wouldn't trust anything else said or any code written by the person who told you that.

2 Likes

Alternatively, that comment could be spot on(if, for example, there are more than two RS232 devices in the mix), if the details of the installation demand it - but we’ll never know without more details, and much more project clarity.

As always, YMMV.

I really cannot go into any specifics, due to NDA. I do know it comes down to the MPU, and since it's 2 Arduinos connected to the PC via USB, could it be due to the wiring (things with SCL/SDA, 3.3/5v) or indeed the USB speed?

Those are the only 2 things that I cannot control.

That shuts this down pretty effectively, for me, anyway. Good luck with your problem.

It would be better if only one IoT board communicated with the PC. Let the PC send the commands to turn on and off the LEDs on the Every board via the IoT

So I'm also not interested in discussing this issue further. If you're developing a proprietary code, it's not very appropriate to ask for help on a hobby forum. You should handle it yourself.

1 Like

Then why comment?

I think we say things like that to let you know where you stand here and what the likelihood of getting any good answers form ppl who know what they are doing might be.

So for general troubleshooting, it sounds like you don't have access to or the ability to modify the code running on the microprocessors. Otherwise serial printing would be a way to confirm the flow through your program and how the values of key variables was affecting it.

Then you might use LEDs for doing the same, avoiding the fact that using serial can change timing in some cases so much as to be less than helpful.

Externally, logic analysis can be helpful. A cheap logic analyzer and open source software can let you see the digital signals and usually decode them according to the protocol employed - I2C or serial or whatever.

For low level electrical issues, get out the oscilloscope and start looking at what is happening you didn't even realize.

a7

I’m having a really hard time seeing “separate the signals out” as an answer to this question.

1 Like

Please tell us when this problem first occurred. Did you test the communications long before you wrote the remaining code?