The Photon 2, manufactured by Particle, is a versatile Wi-Fi development kit designed for creating connected projects and products. It integrates a powerful microcontroller, a Wi-Fi module, and cloud connectivity, making it an ideal choice for IoT (Internet of Things) applications. Whether you're a hobbyist or a professional developer, the Photon 2 offers a robust platform for building and deploying connected devices with ease.
Specification | Value |
---|---|
Microcontroller | ARM Cortex-M4F (120 MHz) |
Flash Memory | 1 MB |
RAM | 256 KB |
Wi-Fi | 802.11 b/g/n (2.4 GHz) |
Operating Voltage | 3.3V |
Input Voltage | 3.6V to 5.5V |
Digital I/O Pins | 18 |
Analog Input Pins | 8 (12-bit ADC) |
Communication | UART, SPI, I2C |
Cloud Connectivity | Particle Cloud |
Dimensions | 36.58mm x 20.32mm |
Pin Number | Pin Name | Description |
---|---|---|
1 | VIN | Input voltage (3.6V to 5.5V) |
2 | GND | Ground |
3 | 3V3 | 3.3V output |
4 | A0 | Analog input 0 |
5 | A1 | Analog input 1 |
6 | A2 | Analog input 2 |
7 | A3 | Analog input 3 |
8 | A4 | Analog input 4 |
9 | A5 | Analog input 5 |
10 | A6 | Analog input 6 |
11 | A7 | Analog input 7 |
12 | D0 | Digital I/O 0 |
13 | D1 | Digital I/O 1 |
14 | D2 | Digital I/O 2 |
15 | D3 | Digital I/O 3 |
16 | D4 | Digital I/O 4 |
17 | D5 | Digital I/O 5 |
18 | D6 | Digital I/O 6 |
19 | D7 | Digital I/O 7 |
20 | RX | UART Receive |
21 | TX | UART Transmit |
22 | SCL | I2C Clock |
23 | SDA | I2C Data |
24 | SCK | SPI Clock |
25 | MISO | SPI Master In Slave Out |
26 | MOSI | SPI Master Out Slave In |
27 | RST | Reset |
Powering the Photon 2:
Connecting to Wi-Fi:
Programming the Photon 2:
Connecting Sensors and Actuators:
Here is an example code to read a temperature sensor connected to A0 and control an LED connected to D0 using the Photon 2:
// Include necessary libraries
#include "Particle.h"
// Define pin assignments
const int tempSensorPin = A0; // Temperature sensor connected to A0
const int ledPin = D0; // LED connected to D0
void setup() {
// Initialize the LED pin as an output
pinMode(ledPin, OUTPUT);
// Initialize the temperature sensor pin as an input
pinMode(tempSensorPin, INPUT);
// Start serial communication for debugging
Serial.begin(9600);
}
void loop() {
// Read the analog value from the temperature sensor
int sensorValue = analogRead(tempSensorPin);
// Convert the analog value to a temperature (example conversion)
float temperature = (sensorValue * 3.3 / 4095) * 100;
// Print the temperature to the serial monitor
Serial.print("Temperature: ");
Serial.print(temperature);
Serial.println(" C");
// Control the LED based on the temperature
if (temperature > 25.0) {
digitalWrite(ledPin, HIGH); // Turn on the LED if temperature > 25 C
} else {
digitalWrite(ledPin, LOW); // Turn off the LED otherwise
}
// Wait for 1 second before the next reading
delay(1000);
}
Wi-Fi Connection Issues:
Power Supply Problems:
Firmware Upload Failures:
Sensor Readings Are Inaccurate:
Resetting the Photon 2:
Entering Safe Mode:
Using the Particle Console:
By following this documentation, users can effectively utilize the Photon 2 for their connected projects and products, leveraging its powerful features and cloud connectivity.