Project tutorial
Arduino Nano 33 IoT Remote Debugging + Coding

Arduino Nano 33 IoT Remote Debugging + Coding © GPL3+

Working through a problem, but only you have the hardware? Want to work with someone remotely as if they were there? This is for you...

  • 293 views
  • 0 comments
  • 1 respect

Components and supplies

Screenshot 2019 06 14 15 39 45 h3it1wigl4
Arduino Nano 33 IoT
Or any Other supported board
×1
STMicroelectronics STLinkv2 Hardware Debugger
Or any Other supported Hardware Debugger
×1
11026 02
Jumper wires (generic)
×1

Apps and online services

About this project

There are often situations where you either don't have the hardware available as its shared between a group, or you have the hardware but need some help working through an issue..

Whether it be in an Educational setting, or in a professional remote working scenario with staff or contractors, the difficulties are the same, and you often end up with at best one person at a time working on the project.

Using Live Share we can allow remote access to our Arduino project code, as well as the Hardware Debugger controls and watch information, as if everyone was sat together around one machine, with additional features to make this as seamless as possible.

Setting up a Share

Sharer(whohasthehardware):

  • Load the Solution you wish to work on, and click on the Live Share button in the top right of the IDE
  • This may give a Hint about allowing this application through your firewall, press OK
  • If access through the firewall is requsted, press OK to confirm it is allowed
  • A new "Live Share" window will appear in your IDE, and there will be a notification at the top of the IDE
  • Click [More Info] to find out more detail, or just [Copy Link] to put the shared session link in your clipboard
  • Share the link copied via Email / Skype (or another mechanism) with the team mates you wish to join the session
  • Wait for them to join.....

NOTE: When the Sharer Disconnects the session, this will disconnect and close all other sessions joined by other users as well.

Joiners(upto5!):

  • Once you have the link, simply click on it.
  • This will load a Web Page, and request to open a file with Visual Studio - press the "Open With Visual Studio" button to load the Shared VS
  • Now you can also load any files or windows you wish in your session, as if you are on the Sharers machine

NOTE: All Users will have a "Live Share" Window showing who is connected to the session, and where each other are (file name) in the solution, as well as a Status indicator so you can show when each other are available or actively working on the solution.

An Example

The below video goes through the basic setup process, and shows an active hardware debugging session being shared between two running instances as if they were remote.

Using Live Share to Remotely work on an Arduino Project

Further Information

https://www.visualmicro.com/page/Live-Session-Sharing.aspx

Code

NanoDebugExample.inoArduino
Basic Sketch to use with debugging, use with other Ino file to use the same code as shown in the example.
const int motor = 12;
int currentMotorPWM = 0;
unsigned long currentPeriodStartTime = 0;
unsigned int currentPeriod_MS = 1000;
unsigned int currentResolution = 254;
unsigned int maxResolution = 254;
int currentPWMVal = 0;
unsigned long loopCounter = 0;

void setup() {
	pinMode(motor, OUTPUT);
	analogWrite(motor, currentPWMVal);
}

void loop() {
	currentPWMVal = calculateCurrentPWM_sine((millis() - currentPeriodStartTime) % currentPeriod_MS);
	pwmWrite(currentPWMVal);
	loopCounter++;
}
Calcs.inoArduino
Additional Code to be used in Debugging Sketch Example
// Encapsualtion 
int calculateCurrentPWM_spiky(unsigned long periodTime) {
	return calculateCurrentPWMMultiplier(periodTime) * currentResolution;
}

int calculateCurrentPWM_sine(unsigned long periodTime) {
	return
		round(
			abs(int(
			(
				sin(
				(
					double(calculateCurrentPWM_spiky(periodTime))
					/ 165.00
					)
				)
				)
				* double(currentResolution)
				)
			)
		);
}


int oldValue = -1;
void pwmWrite(int value) {
	if (oldValue != value) {
		analogWrite(motor, value);
		oldValue = value;
		Serial.print(",");
		Serial.print(value);
	}
}

double calculateCurrentPWMMultiplier(unsigned long periodTime) {
	if ((double(periodTime % currentPeriod_MS) / double((currentPeriod_MS / 2.00))) <= 1.00) {
		return (double(periodTime % currentPeriod_MS) / double((currentPeriod_MS / 2.00)));
	}
	else {
		return (1.00 - ((double(periodTime % currentPeriod_MS) - double((currentPeriod_MS / 2.00))) / double((currentPeriod_MS / 2.00))));
	}
}

Schematics

Example Nano33 IoT Connection Diagram
How to Connect the Nano-33 IoT to a Hardware Debugger
Debug help nano33iot jlink connections papwulnvlr

Comments

Similar projects you might like

Arduino Nano 33 IoT Debugging

Project tutorial by visualmicro

  • 3,253 views
  • 3 comments
  • 12 respects

Arduino Nano 33 BLE/IoT Custom Debugging

Project tutorial by visualmicro

  • 1,040 views
  • 0 comments
  • 4 respects

Arduino Uno Debugging

Project tutorial by visualmicro

  • 1,467 views
  • 0 comments
  • 5 respects

MQTT Communication With the Nano 33 IoT & WeMos D1 Boards

Project tutorial by Frenoy Osburn

  • 4,918 views
  • 2 comments
  • 16 respects

Nano 33 IoT + EC/pH/ORP + WebAPK

Project tutorial by uFire

  • 14,798 views
  • 4 comments
  • 52 respects

Nano IR Remote for DC Motors

Project showcase by Boaz Lawnce

  • 2,604 views
  • 2 comments
  • 4 respects
Add projectSign up / Login