Raspberry Pi 3 Unresponsive to particle

I have added the beta version of Particle to the raspberry pi. It was running great all day yesterday. I flashed some new code this morning and it ran for an hour and then it “went offline”. I rebooted the pi and now whenever I try and re-flash the request times out despite the IDE seeing the pi as online? Any tips on how to reboot the particle software specifically on the pi?

Let me ping someone that might be able to help, @rickkas7 or @ParticleD are you able to assist?

You can reset the Particle Agent to an initialized state (running Tinker) by doing

particle-agent setup

That’s documented here (see the green box).


pi@raspberrypi:~ $ sudo particle-agent setup
Let's connect your Raspberry Pi to the Particle Cloud!

You are already logged in as cameron.owen@live.com.au.
Do you want to stay logged in as this user? |yes| yes
How do you want your device to be labeled in the Particle tools?
Name: |pi| 
Generating RSA private key, 1024 bit long modulus
e is 65537 (0x10001)
writing RSA key
writing RSA key
⠴  Claiming the device to your Particle account 
/usr/lib/ruby/vendor_ruby/particle/device.rb:28:in `initialize': undefined method `key?' for nil:NilClass (NoMethodError)
	from /usr/lib/ruby/vendor_ruby/particle/client/devices.rb:19:in `new'
	from /usr/lib/ruby/vendor_ruby/particle/client/devices.rb:19:in `device'
	from /usr/lib/ruby/vendor_ruby/particle/client/devices.rb:47:in `claim_device'
	from /usr/lib/ruby/vendor_ruby/particle/device.rb:75:in `claim'
	from /usr/lib/ruby/vendor_ruby/particle_agent/setup.rb:250:in `claim_device'
	from /usr/lib/ruby/vendor_ruby/particle_agent/setup.rb:67:in `block in run!'
	from /usr/lib/ruby/vendor_ruby/whirly.rb:170:in `start'
	from /usr/lib/ruby/vendor_ruby/particle_agent/spinner.rb:12:in `show'
	from /usr/lib/ruby/vendor_ruby/particle_agent/setup.rb:64:in `run!'
	from /usr/lib/ruby/vendor_ruby/particle_agent/cli.rb:16:in `setup'
	from /usr/lib/ruby/vendor_ruby/thor/command.rb:27:in `run'
	from /usr/lib/ruby/vendor_ruby/thor/invocation.rb:126:in `invoke_command'
	from /usr/lib/ruby/vendor_ruby/thor.rb:359:in `dispatch'
	from /usr/lib/ruby/vendor_ruby/thor/base.rb:440:in `start'
	from /usr/bin/particle-agent:16:in `<main>'

Upside is I’m now able to flash it. I don’t think it fully completed the setup but comms is running and the flash worked.

Then it stopped running immediately and now it’s unresponsive again.

#include "Particle.h"
#include <math.h>
// -----------------------------------------
// Execute a script and publish the result
// -----------------------------------------
void publishData();

const unsigned long PUBLISH_PERIOD_MS = 10000; //Interval which firebase is updated in MS
const unsigned long FIRST_PUBLISH_MS = 5000; //Initial firebase update delay
const char *PUBLISH_EVENT_NAME = "light-data"; //Variable to save data under on firebase
//const char *PUBLISH_EVENT_NAME_HISTORY = "light-data-history"; //Variable to save data under on firebase

unsigned long lastPublish = FIRST_PUBLISH_MS - PUBLISH_PERIOD_MS; //Last time published

double cpuTemp = 0;

void setup() {
  Particle.variable("cpuTemp", &cpuTemp, DOUBLE); //Expose a variable through the cloud

void loop() {
  // Measure the CPU temperature by running the vcgencmd program
  Process proc = Process::run("vcgencmd measure_temp");
  // Wait for vcgencmd to finish

  // The output is temp=43.5'C so fast-forward until the the character = is found
  // Convert the string to a number
  cpuTemp = proc.out().parseFloat();

  // Publish the event to the Particle cloud. It will be visible in the Console.
  //Particle.publish("cpu_temp", String(cpuTemp), PRIVATE);

  // Repeat after a 1 second pause

void publishData(double newTemp) 
	char buf[256]; //creates a character buffer with a maximum size of 256 characters long
	snprintf(buf, sizeof(buf), "{\"lux\":%f}", newTemp); //Creates the buffer with the appropriate information
	Serial.printlnf("publishing %s", buf); //Prints output to serial. Used for debugging purposes.
	Particle.publish(PUBLISH_EVENT_NAME, buf, PRIVATE); //Sends buffer to firebase
	//Particle.publish(PUBLISH_EVENT_NAME_HISTORY, buf, PRIVATE); //Sends buffer to firebase

Reboot has it running. I’ll monitor to see how long it last before it falls over.