Created by Matthew Bon, last modified on Dec 23, 2016
Overview
The goal of this project was to demonstrate how to control and receive data from a Panasonic Grid Eye Sensor remotely using a BLE connection. The Cypress EZ-BLE module was chosen because of its flexibility and ease of use.
The example application utilizes the Cypress semiconductor PSOC 4 BLE pioneer board as the GAP Central and GATT Client device. You can purchase that kit here: CY8CKIT-042
Disclaimer
The design shown on this webpage is purely for demonstration and evaluation purposes. It is not a reference design and is not guaranteed to pass FCC or other regulatory testing. It is the responsibility of the user to follow all applicable laws when utilizing this design.
Schematic, Gerbers, Source Code, and Kicad Artwork
Schematic:
Gerbers:
Source Code:
The following zip file contains a PSOC creator workspace which contains both the BLE Central and BLE Peripheral projects.
Kicad Artwork:
For those of you who use Kicad, the schematic and board files are found below. In addition, a library which contains footprints for the PROC module and Grid Eye Sensor is also included.
Bill of Materials
Quantity | Designator | Digikey PN | Description | Manufacturer |
---|---|---|---|---|
1 | C1 | 445-5173-1-ND | CAP CER 1.5UF 6.3V X5R 0603 | TDK Corporation |
1 | C2 | 1276-1946-1-ND | CAP CER 1UF 10V X7R 0603 | Samsung Electro-Mechanics America, Inc |
1 | C3 | 1276-1119-1-ND | CAP CER 10UF 6.3V X5R 0603 | Samsung Electro-Mechanics America, Inc |
1 | C4 | 311-1088-1-ND | CAP CER 0.1UF 16V X7R 0603 | Yageo |
1 | C5 (CMOD, value can vary, typically 2.2 nF) | 490-1459-1-ND | CAP CER 2200PF 50V NP0 0603 | Murata Electronics North America |
1 | D1 | MMSZ4684-TPMSCT-ND | DIODE ZENER 3.3V 500MW SOD123 | Micro Commercial Co |
1 | D2 | 160-1434-1-ND | LED ORANGE CLEAR 0603 SMD | Lite-On Inc |
1 | JP1 | 3M9455-ND | CONN HEADER VERT SGL 20POS GOLD | 3M |
1 | JP2 | A28783-ND | CONN HEADER RT/A .100 2POS 15AU | TE Connectivity AMP Connectors |
2 | JP3, JP4 | N/A | Any 0.100" (2.54mm) Pitch Through Hole Connector | N/A |
1 | L1 | 490-5988-1-ND | FERRITE BEAD 330 OHM 0805 | Murata Electronics North America |
1 | R1 | 311-20.0HRCT-ND | RES SMD 20 OHM 1% 1/10W 0603 | Yageo |
1 | R2 | 311-10KGRCT-ND | RES SMD 10K OHM 5% 1/10W 0603 | Yageo |
1 | R3 | 311-100HRCT-ND | RES SMD 100 OHM 1% 1/10W 0603 | Yageo |
1 | U1 | 428-3408-1-ND | MOD EZ-BLE PROC 48MHZ 21SMD | Cypress Semiconductor Corp |
1 | U2 | 255-3509-1-ND | SENSOR GRID-EYE 3.3V HIGH GAIN | Panasonic Electronic Components |
Note : It is possible to modify this design to use 5 volts instead of 3.3 volts. You’ll need to use the one of the 5 volt Grid Eye sensors such as the P19004CT-ND. Also, you’ll need to replace the 3.3V zener with a 5V one.I haven’t tested this modification so I can’t guarantee that it will work, but there shouldn’t be any major issues. The user should avoid applying more than 5.5 volts to the EZ-BLE module, as damage will result.
Demo Application Overview
The demo application demonstrates a simple setup in which the PROC demo board shown above functions as GAP peripheral and GATT server and a PSOC BLE pioneer board serves as a GAP Central and GATT Client. The user is able to control the process by communicating with the pioneer board via a terminal interface. The PROC demo board utilizes a custom BLE profile for transferring the data from the Grid Eye sensor to the GATT Client device. The profile consists of the following services and characteristics:
-
Grid Eye Commands- This service accepts the commands from the user.
- Grid Eye Commands- The user writes their commands to this characteristic.
-
Grid Eye Data- This service displays the value of all 64 pixels as well as the Grid Eye’s thermistor.
- Grid Eye Data-This characteristic stores the data from the 64 pixels plus the thermistor data.
-
Thermistor Data- This service allows the user to get just the value of the Grid Eye’s thermistor.
- Thermistor Data- This characteristic stores the thermistor reading
-
Pixel Data- This service allows the user to read the value of a single pixel.
- Pixel Data- This stores the reading from a single pixel
- Pixel Number- The user writes to this characteristic in order to determine which pixel to read from.
Flow charts demonstrating the basic algorithms for both the PROC demo board (BLE peripheral) and PSOC pioneer board (BLE Central) are shown below:
BLE_Perihperal
BLE_Central
Packet Structure:
When the streaming mode is enabled, the BLE central will continuously receive data packets from the PROC Demo board. Each packet contains 130 bytes where the first 128 are the temperature values of each pixel and the last two bytes are the temperature values for the grid eye’s thermisistor. Each pixel on the grid eye has 12 bits of resolution broken up into two 8 bit registers. Thus each pixel will be represented by two values in the packet. The packet is formatted so that the lower value, the 8 least significant bits, arrives first followed by the high value, the 4 most significant bits. The pairs arrive sequentially so the values from pixel 1 will be the first two values in the packet and the values from packet 64 are the last two before the thermistor values. The two bits for the thermistor follow this same format. An example packet is shown below:
Uploading the Demo Application to the Board
Programming using the Cypress miniprog 3
The cypress miniprog3 is a programmer/debugger that supports most of Cypress psoc and proc products. It can be purchased from digikey here: 428-2975-ND
-
Ensure that PSOC creator is installed on your PC.
-
Make sure that you have downloaded and opened the Panasonic GridEye BLE project in PSOC creator. This project can be found in the ‘Source Code’ section above.
-
Plug the miniprog3 into your computer and ensure that all the drivers install properly. Do not attach the minprog3 to the PROC demonstration board yet!
-
In PSOC creator, navigate to Tools->Options->Port Config and ensure the settings match the picture below. Note, using the ‘Reset’ acquire mode instead of ‘Power Cycle’ will also work, but ‘Power Cycle’ will have the added benefit of resetting the Grid Eye sensor as well.
-
Attach the miniprog3 to the development board as shown in the photo below:
-
In PSOC creator, right click on "Grid Eye (Peripheral)’ and select ‘Set as Active Project’. From there, click on the ‘Debug’ menu and select ‘Program’. The miniprog3 should then proceed to program the PROC demo board.
Programming using the CY8CKIT-042
If you are unwilling to spring for a miniprog3, it is also possible to program the demo board using the CY8CKIT-042 PSOC pioneer board.
-
Plug the PSOC pioneer board into your PC. Ensure that all the drivers install correctly.
-
Make sure that you have downloaded and opened the Panasonic GridEye BLE project in PSOC creator. This project can be found in the ‘Source Code’ section above.
-
Ensure that jumper J16 on the pioneer board is in the 3.3v position.
-
Remove the module that plugs into headers J10 and J11 on the baseboard. Next to J11, note the silkscreen indicate which pins on the header are the programming pins.
-
Using the silkscreens as a guide, connect the pins on J11 to the programming header on the PROC demo board.
-
In PSOC creator, navigate to Tools->Options->Port Config and ensure the settings match the picture below. Note, using the ‘Reset’ acquire mode instead of ‘Power Cycle’ will also work, but ‘Power Cycle’ will have the added benefit of resetting the Grid Eye sensor as well.
-
In PSOC creator, right click on "Grid Eye (Peripheral)’ and select ‘Set as Active Project’. From there, click on the ‘Debug’ menu and select ‘Program’. The pioneer board should then proceed to program the demo board.
Setting up and running the Demo
-
Ensure that the PSOC 4 BLE (red module) is plugged into the PSOC pioneer board.
-
Connect to the PSOC pioneer board into to your PC and program it with the Grid Eye (Central) program.
-
Once the board is programmed, open a terminal connection with the board. The
-
Either program the PROC demo board using one of the methods shown in the previous section or, if the board has already been programmed, apply power to the board.
-
Once the two boards connect to each other, the following message should appear on the terminal. You might have to press the reset button the PSOC pioneer board to get this message to appear.
-
You can now send commands to the PROC demo board. Sending command ‘A’ should return the value of the Grid Eye’s thermistor.
-
The command ‘B’ will return a prompt to enter a pixel number. Once you enter number, the temperature value of that pixel will be returned.
-
The command ‘C’ will start streaming data from PROC demo board. The packets will continue to be received and printed to the screen until the user enters the ‘D’ command. An example of two received packets are shown below.
Known Issues & Caveats
Hardware:
- The pcb is larger than it needs to be. Since there were really no size requirements in this project, I was overly conservative in my design so i wouldn’t have to explain to my boss that I needed to respin the board if i screwed up.
- While JP3 and JP4 are breadboard compatible, the board itself is slightly too wide to be used in a typical, 2.13x6.496 breadboard.Thus a larger breadboard will need to be used if the user wants to plug the evaluation board into a breadboard.
- C4 is a filter cap for the Reset line of the PROC module. If you are having issues with noise on the reset line, try changing the value of this capacitor.
- C5 is the CMOD cap for Cypress’s Capsense touch controller peripheral. If you do not plan on utilizing Capsense, this capacitor can be disregarded.
Demo Application
- If the PROC is reset during operation, it is possible for the Grid eye sensor to “hang” and stop communicating with the PROC. This can be fixed by power cycling the demo board.
- After the “Stop streaming data” command is sent, there is a two second delay before new commands can be issued. This is to ensure that the BLE Client device receives the final packet in the transmission queue and that the final packet doesn’t arrive when the Client executing other tasks. If the user finds this delay unacceptable, it is possible modify the code so that this delay isn’t necessary.
- While the algorithm for parsing the user’s input is fairly robust, it is possible that certain sequences of inputs could put the program in an undefined state. In this case, it might be necessary to power cycle both the BLE central and BLE peripheral to restore functionality.
Acknowledgements
I would like to thank Chris Baird and Johnathon Richardson for the earlier work they did with the Grid Eye sensors. A large amount of this project was based on their articles which you can find on EEwiki.
I would also like to thank Scott Raeker who suggested to me the idea of adding BLE connectivity to the Grid Eye Sensors.