Cirkit Designer Logo
Cirkit Designer
Your all-in-one circuit design IDE
Home / 
Component Documentation

How to Use photon 2: Examples, Pinouts, and Specs

Image of photon 2
Cirkit Designer LogoDesign with photon 2 in Cirkit Designer

Introduction

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.

Explore Projects Built with photon 2

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
Photon 2 Motion Detector Alarm with PIR Sensor and Wi-Fi Control
Image of final project: A project utilizing photon 2 in a practical application
This circuit is a motion-activated alarm system using a Photon microcontroller, a PIR sensor, a piezo buzzer, a red LED, and a pushbutton. When motion is detected by the PIR sensor, the red LED lights up and the buzzer sounds an alarm, which can be deactivated manually via the pushbutton or remotely through the Particle Cloud.
Cirkit Designer LogoOpen Project in Cirkit Designer
ESP32-Based Wi-Fi Controlled Laser Shooting Game with OLED Display
Image of 123: A project utilizing photon 2 in a practical application
This circuit is a laser shooting game controlled by a PS3 controller, featuring an ESP32 microcontroller, two photosensitive sensors for light detection, and a motor driver to control two DC motors. The game includes an OLED display for score visualization, and a MOSFET to control an LED bulb, with power supplied by a 12V battery and regulated by a DC-DC step-down converter.
Cirkit Designer LogoOpen Project in Cirkit Designer
ESP32-Based Security System with RFID and Laser Intrusion Detection
Image of CPE doorlock system upgrade: A project utilizing photon 2 in a practical application
This circuit is a security and access control system featuring motion detection, laser beam-break sensing, and RFID scanning, interfaced with a keypad and visual/audible indicators, powered by a solar-charged battery, and capable of controlling an electric lock via a relay.
Cirkit Designer LogoOpen Project in Cirkit Designer
Battery-Powered Laser Emitter with Solar Charging and LED Indicator
Image of rx: A project utilizing photon 2 in a practical application
This circuit is a solar-powered laser emitter system with an LED indicator. The solar panel charges a 18650 battery via a TP4056 charging module, and a push button controls the activation of the laser emitter and the LED through a MOSFET switch.
Cirkit Designer LogoOpen Project in Cirkit Designer

Explore Projects Built with photon 2

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
Image of final project: A project utilizing photon 2 in a practical application
Photon 2 Motion Detector Alarm with PIR Sensor and Wi-Fi Control
This circuit is a motion-activated alarm system using a Photon microcontroller, a PIR sensor, a piezo buzzer, a red LED, and a pushbutton. When motion is detected by the PIR sensor, the red LED lights up and the buzzer sounds an alarm, which can be deactivated manually via the pushbutton or remotely through the Particle Cloud.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of 123: A project utilizing photon 2 in a practical application
ESP32-Based Wi-Fi Controlled Laser Shooting Game with OLED Display
This circuit is a laser shooting game controlled by a PS3 controller, featuring an ESP32 microcontroller, two photosensitive sensors for light detection, and a motor driver to control two DC motors. The game includes an OLED display for score visualization, and a MOSFET to control an LED bulb, with power supplied by a 12V battery and regulated by a DC-DC step-down converter.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of CPE doorlock system upgrade: A project utilizing photon 2 in a practical application
ESP32-Based Security System with RFID and Laser Intrusion Detection
This circuit is a security and access control system featuring motion detection, laser beam-break sensing, and RFID scanning, interfaced with a keypad and visual/audible indicators, powered by a solar-charged battery, and capable of controlling an electric lock via a relay.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of rx: A project utilizing photon 2 in a practical application
Battery-Powered Laser Emitter with Solar Charging and LED Indicator
This circuit is a solar-powered laser emitter system with an LED indicator. The solar panel charges a 18650 battery via a TP4056 charging module, and a push button controls the activation of the laser emitter and the LED through a MOSFET switch.
Cirkit Designer LogoOpen Project in Cirkit Designer

Common Applications and Use Cases

  • Home Automation: Control lights, thermostats, and other home appliances remotely.
  • Industrial Automation: Monitor and control machinery and processes in real-time.
  • Wearable Devices: Develop smart wearables with cloud connectivity.
  • Environmental Monitoring: Collect and analyze data from sensors for air quality, temperature, humidity, etc.
  • Prototyping: Quickly prototype and test IoT solutions.

Technical Specifications

Key Technical Details

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 Configuration and Descriptions

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

Usage Instructions

How to Use the Component in a Circuit

  1. Powering the Photon 2:

    • Connect the VIN pin to a power source (3.6V to 5.5V).
    • Connect the GND pin to the ground of the power source.
  2. Connecting to Wi-Fi:

    • Use the Particle mobile app or Particle CLI to configure the Wi-Fi credentials.
  3. Programming the Photon 2:

    • Use the Particle Web IDE, Particle Workbench, or Particle CLI to write and upload code.
  4. Connecting Sensors and Actuators:

    • Use the digital and analog pins to connect various sensors and actuators.
    • For example, connect a temperature sensor to an analog pin (A0) and an LED to a digital pin (D0).

Important Considerations and Best Practices

  • Power Supply: Ensure a stable power supply to avoid unexpected resets or malfunctions.
  • Pin Usage: Avoid exceeding the maximum current ratings for the I/O pins.
  • Wi-Fi Signal: Ensure a strong Wi-Fi signal for reliable cloud connectivity.
  • Firmware Updates: Regularly update the firmware to benefit from the latest features and security patches.

Example Code

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);
}

Troubleshooting and FAQs

Common Issues Users Might Face

  1. Wi-Fi Connection Issues:

    • Solution: Ensure the correct Wi-Fi credentials are entered. Check the signal strength and try moving closer to the router.
  2. Power Supply Problems:

    • Solution: Verify the power source provides a stable voltage within the specified range (3.6V to 5.5V).
  3. Firmware Upload Failures:

    • Solution: Ensure the Photon 2 is in DFU mode (blinking yellow) and the USB cable is properly connected. Use the Particle CLI to flash the firmware.
  4. Sensor Readings Are Inaccurate:

    • Solution: Check the sensor connections and ensure the correct pin is used. Calibrate the sensor if necessary.

Solutions and Tips for Troubleshooting

  • Resetting the Photon 2:

    • Press and hold the RST button to reset the device.
  • Entering Safe Mode:

    • Press and hold the MODE button until the LED blinks magenta to enter Safe Mode. This can help troubleshoot firmware issues.
  • Using the Particle Console:

    • Use the Particle Console to monitor device logs, check cloud connectivity, and manage firmware updates.

By following this documentation, users can effectively utilize the Photon 2 for their connected projects and products, leveraging its powerful features and cloud connectivity.