MDBT42 crashes after about 1 week

Posted on
  • Hi, I've got a Puck attached to my main house electricity meter monitoring consumption and a MDBT42 on a meter that is connected to my solar panels. In general it's all running brilliantly.

    Both devices essentially have the same code. There are subtle differences as the house meter has 800 flashes per kwh whereas the solar meter has 1000/kwh.

    The MDBT42 'crashes' after about a week and I cannot connect to it. The IDE connects but then reports a disconnected error message immediately. I therefore have to restart the device.
    The puck has been up and running for weeks without issue.

    The puck has a coin cell power whereas the MDBT42 is powered by usb. I cut up an old usb cable and soldered it to get power. The power is supplied by a standard 3pin plug/usb output.

    I keep losing my historic data so it's a smidge frustrating (note to self update the code to store the historic data better).

    Do you have any ideas why the device crashes when the Puck is absolutely fine?
    Unfortunately when it 'crashes' I cannot connect to it so I've not been able to see any errors (note to self write any exception to storage).


  • Hi - that is a strange one... Are you definitely connecting to the 'Vin' pin and not accidentally putting the USB 5v onto the 3.3v pin?

    Have you tried connecting from a different connector/phone? Often if I see the IDE connecting but then disconnecting immediately it's an issue with my PC rather than the module. Could it be paired from within your OS settings?

    Some things to try...

    • Use the NRF.on('connected' and disconnected events to light a LED up so you can see if the board is actually being connected to
    • use a setInterval every 10 secs to blink a LED - so you can see if the board is still 'alive'
    • Maybe use 'NRF.sleep()' and then call 'NRF.wake' when you press a button. It'll stop it advertising anything or being connectable normally, so might avoid the possibility that some other device is connecting to it by bluetooth and sending it something that's breaking it
  • Hi @Gordon thanks for your reply.

    Over the weekend I swapped from a USB via mains socket to an old 12v leisure battery with 2w solar trickle charger so I'll see if the power supply has been the issue.

    I've found during testing that if say I had my phone connected to the device and then tried to connect to the device that it wouldn't even display as an option to connect to. I'm now at the point where I only really connect to the device on my laptop as that's where I've got my web page to display the results.

    The board is encased in a little black box and glued onto my meter so it can pick up the flashes. So no LED is visible.

    In terms of connection I am using the Vin/GND as per the diagram.

    It's set to snow and be cloudy for the next few days so the MDBT42 won't be counting many flashes...


    1 Attachment

    • Annotation 2022-03-29 091932.png
  • Vin/GND is perfect, so yes, lets see if the battery helps.

    I've found during testing that if say I had my phone connected to the device and then tried to connect to the device that it wouldn't even display as an option to connect to.

    Yes, this is what you'd expect.

    If you had any other way to display information (eg soldering a LED onto some other pins) so you can see if the code is actually running or not that could be really handy.

    If you were to modify the code to save everything to nonvolatile storage then you could also just enable the watchdog timer, which would make 100% sure the device could never crash (not that it should anyway).

  • Thanks @Gordon

    Yeah my next axe approach was going to be to 'schedule' a restart every x days if my latest power source doesn't resolve the issue.
    At least I'm now physically downloading and storing the historic data so if it does crash I don't lose anything.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview

MDBT42 crashes after about 1 week

Posted by Avatar for user121340 @user121340