CPX Circuit On/Off
Purpose
Statement of Work Template intended for Datacenter Volunteer Lead Community Engagements.
Materials
- 1 AAA Battery housing
- 6 AAA Batteries (3 spare)
- 1 Circuit Playground Express
- 2 MiniGrabber cables
- Data/Sync USB Cable
Action Plan
Before
Test the equipment Start Procedure below and note any failures or missing items as described in After Procedure below. For help, use the Get Help information below. Internet access will be required to download the CPX program.
Start
Read through Source 1 below. When you are ready, move the image (Source 2) to the CPX. Use instructions located here: Source 2. Test the program.
Get Ready
Prep the CPX: Connect the USB-A/MicroUSB cable to the computer USB port. Connect the MicroUSB end to the CPX. Press the reset button twice, like a double-click. A CPLAYBOOT drive should appear. Use the information in Program 1 to add the bootloader to the CPX as in Source 2.
Power the CPX: Insert the batteries into the battery pack. Connect the battery pack to the CPX. Power on the battery pack.
Go
This program contains three elements:
- Programming the CPX Bootloader to work with MakeCode Bootloader
- Using the analog read to determine voltage transmitted
- When voltage is detected, lights will change to magenta
See Appendix for Details. Use the Lesson information to explain the lab to relatable concepts at the Datacenter.
After
Note any items that are damaged, not working, or missing (including consumables) as noted in Get Help below.
Source
- The program utilizes a simple code in MakeCode. See Program 1 below for programming details.
Get Help
For any questions contact dc-stem@microsoft.com.
Appendix
Once the Circuit Playground Express (CPX) has been programmed and connected to the battery pack, the lights will display blue. Connect one MiniGrabber from GND to GND. Use another MiniGrabber to connect 3.3V to A1. The light will turn magenta. Disconnect the 3.3V and the light will change to blue. This shows a circuit that has been connected.
A CPX not powered and not connected with MiniGrabbers.
Lesson
The purpose of this hands-on STEM lab is to educate the community about Datacenters. The lights and actions may not exactly replicate, but loosely relate to operations at a datacenter.
What:
This lab demonstrates security intrusion and can be used to explain basic electrical circuits.
Details:
Without proper critical environments in a Microsoft Datacenter, the power and network systems would become unstable. Using the most basic concept of electricity (continuity on a circuit), this lab will explain simpler aspects of Critical Environments.
Share:
Define Critical Environment and basic concepts. Critical environments are separate, stand-alone areas within a building that require different environmental conditions. Air quality, humidity, temperature, air flow, spacing, and other requirements make up the controlled conditions that are required. The most basic of these is a steady source of power/energy to power the equipment. Datacenters have thousands of servers that contain many many Terabytes of data. Essential and consistent power is needed to keep the data and equipment stabilized and available 24/7/365. Heating, cooling, and backup generators are a major maintenance concern. Here we will show how electricity powers a device.
NOTE: This lab works by connecting the 3.3V output to the A1 touch capacitor which is reading the voltage in amount. To reset the program, press the reset button on the CPX.
Source 1
The Adafruit Circuit Playground Express (CPX) is a microcontroller with more power, storage space, and RAM than a 386 Intel Computer. It includes temperature, light, sound, and accelerometer sensors, 10 built in LEDS, speaker, two push buttons, one slide switch, IR receiver and transmitter, 8 analog inputs, power output, 7 capacitive touch inputs, green “ON” LED, reset button, ATSAMD21 ARM Cortex M0 Processor, 2 MB of SPI Flash storage, and a Micro USB port for programming and debugging.
Source:
There are three ways to program the CPX:
- makecode.adafruit.com
- CircuitPython
- Arduino
This program was created with makecode.adafruit.com. Makecode is a Microsoft product that allows for block style coding. The program written for this STEM activity is located below in Program 1.
When the CPX is first connected to a computer with the USB cable, it will run the program that is stored on the device. This may not be the program that you desire to run. Follow the procedure in Source 3 to reset the CPX to the factory settings. The CPX will hold the program and not reset to factory settings upon power off.
Source 2
To create this program, open makecode.adafruit.com. Select New Project. Add the program block code components as required in Program 1. Save the file.
To move the program to the CPX:
- Plug in the CPX via the USB/Micro USB cable
- Press the reset button twice on the CPX
- All Pixel LED lights will turn on / solid green
- The on small LED will turn on / solid green
- D13 small LED will slowly blink red
- A folder will appear as CPLAYBOOT
- This will be very similar to a USB thumb drive in function.
- Copy the saved UF2 file from the Intrusion folder and paste it on the CPLAYBOOT root drive
- The CPX lights will flash, then reset and the CPLAYBOOT drive will disappear from the drive list
- The program is now installed
To test the program:
- Press the reset button on the CPX
- Once the Circuit Playground Express (CPX) is connected, without MiniGrabbers attached, all LEDs will display blue
To troubleshoot the CPX device and program:
- Check the batteries
- Press reset button 1 time. This will reset the device, like a computer reboot/restart.
- Follow steps in Source 1 to download the program to the CPX device.
- Try another device and see if the problem repeats. If it repeats check program in Source 1 and 2 to install the program again.
- Follow the procedure in Source 3 below to reset to factory settings. Then repeat the procedure to install the Intrusion program.
Source 3
Download the original CPX bootloader, navigate to UF2 Bootloader Details | Adafruit Feather M0 Express | Adafruit Learning System (https://learn.adafruit.com/adafruit-feather-m0-express-designed-for-circuit-python-circuitpython/uf2-bootloader-details). Scroll to the bottom of the page and click on the green rectangle, with Circuit Playground Express V#.#.# update-bootloader.uf2. Click on the link (make sure it is for the Circuit Playground Express). The file will download.
To move the bootloader to the CPX:
- Plug in the CPX via the USB/Micro USB cable.
- Press the reset button twice on the CPX.
- All Pixel LED lights will turn on / solid green
- The ON small LED will turn on / solid green
- D13 small LED will slowly blink red
- A folder will appear as CPLAYBOOT (This will be very similar to a USB thumb drive in function).
- Copy the saved UF2 file (from the above procedure) and paste it on the CPLAYBOOT root drive.
- The CPX lights will flash, then reset and the CPLAYBOOT drive will disappear from the drive list
The CPX is now ready with the original bootloader.
Program 1
To create this program, open MakeCode.adafruit.com. Create the bootloader file by creating the block code program below:
Program the CPX as listed in Source 1.