Forum

Reset Arduino from ...
 
Notifications
Clear all

Reset Arduino from Brucontrol

2 Posts
2 Users
0 Reactions
41 Views
(@laurancasteleijn)
Member
Joined: 3 years ago
Posts: 2
Topic starter  

Please can you advise? I'm monitoring and controling and steering fermentation with Brucontrol. Unfortunately, arduino's fall off from the network regularly. I have a protocol arduino_detection.bcs (runs inside BruControl every 60s)

→ checks MEGA.connected
→ sets Arduino1_Online = 1 or 0
→ can fires tx "MEGA" %N if offline
→ sets Arduino1_RebootFailed = 1 if still offline after 15s
↓ BruControl API
arduino_monitor.py (runs on your PC)
→ reads Arduino1_Online from API every 60s
→ logs OFFLINE / BACK ONLINE on state changes only.

FOR TESTING I would need the %N BruControl reboot command, can you please provide the %N reboot command? Tahnk you. 

// Arduino Controller Monitor & Reboot

// File: arduino_detection.bcs

//

// Run this script on a timer (recommended: every 60 seconds)

//

// What it does:

// 1. Checks each Arduino controller's built-in .connected status

// 2. Updates Arduino1_Online / Arduino2_Online / Arduino3_Online globals

// (1 = online, 0 = offline) — Python reads these from the API

// 3. If a controller is offline, sends the reboot command

// 4. Waits 15s then checks if it recovered
// 5. Sets ArduinoX_RebootFailed = 1 if still offline after reboot
 
The Brucontrol script suggested
if [MEGA.connected] == true

set [Arduino1_Online] = 1

set [Arduino1_RebootFailed] = 0

else

set [Arduino1_Online] = 0

tx "MEGA" %N // ← replace %N with reboot command

sleep 15000 // wait 15s for controller to reboot

if [MEGA.connected] == true

set [Arduino1_Online] = 1

set [Arduino1_RebootFailed] = 0

else

set [Arduino1_RebootFailed] = 1 // flag for dashboard indicator

endif

endif

//

// NOTE: After replacing %N with the correct BruControl reboot command I can test it. Thank you in advnce for your support! Any other idea?


   
Quote
(@pbruno3)
Reputable Member Admin
Joined: 9 years ago
Posts: 344
 

Hi. Sorry, I'm not sure where you got a "reboot" command. There is not one currently in the firmware. And the code you have is not correct syntax... for example BC does not have a set command.

The reality of a microcontroller is that it cannot get into a funky state. It either runs or it doesn't, and if its not running, no software command would fix it.

If you are losing network connectivity, its likely something else than the code state. Likely either a power supply problem or a network one.



   
ReplyQuote
Share: