4 Replies Latest reply on Jun 18, 2014 11:57 PM by b4ux1t3

    CY3280-MBR3 Example with Raspberry Pi

    cy.wbz

      Hello!


      Today I’m posting an example project using our new CY3280-MBR3CY3280-MBR3 CapSense evaluation kit with the popular Raspberry Pi development tool. This example builds on our earlier example showing the CY3280-MBR3CY3280-MBR3 kit working with the Arduino development kits.


      image4.png


      In this example we show how the user can configure the CY3280-MBR3CY3280-MBR3 kit using a python script on their Raspberry Pi development environment. In this example the python code runs on the Raspberry Pi model B board using the Rasbian Wheezy image and configures the MBR3 device with the Water Tolerance demonstration. The python example code also reads and displays the button status on the python shell output.


      The CY3280-MBR3CY3280-MBR3 evaluation kit interfaces with our EZ-Click software tool. Note this development tool is not supported on Linux systems. The output files are text files and can be send or copied onto a the Raspberry Pi.

       

      www.cypress.com/go/EZ-Click


      Forum Post Attachments:

      At the bottom of this post we are including the following items:

      • EZ-Click MBR3 example project
      • Raspberry Pi Python Script
      • Example Guide


      Software:


      The following example will need software versions:

      • Configured Raspberry Pi System
      • MBR3 Python script
      • EZ-Click 2.0


      Firmware:


      What is important to understand is that there is no firmware development for the MBR3 device family. The MBR3 devices are configured over I2C setting registers inside of the device to enable or disable certain features. On the MBR3 kit we support four CapSense buttons and one Proximity loop sensor. This kit can easily provide a CapSense front panel to your design.


      We have provided in the download section of the post we have included the Python script for the Raspberry Pi. The Water Tolerance example project is available in the kit installer for the CY3280-MBR3 kit.


      In this example project the python script configures the target MBR3 device and then reads and displays the button status on the output window.


      Attached to this example is an example guide that can help you navigate through the example.


      Hardware Connections:


      The following list of steps will help you configure your hardware to ensure proper functionality.

      1. Connect the MBR3 I2C Lines from pin-2 of J13 and J14 jumpers to corresponding I2C lines of Ras pi available on P1 header.
      2. Connect the MBBR3 GND to Ras Pi GND on available on P1 header
      3. Power the MBR3 kit separately using the Mini USB cable
      4. Note: Don’t power the Kit from the 5V connection available on P1 header of the Ras Pi.
      5. Keep the Jumper J11, J12 shunted.
      6. Keep J15 jumper in “C” configuration i.e. Enable Buzzer and Water Tolerance enabled.
      7. If you want to enable different features just generate the 128 byte of configuration data using Ez-Click and replace the data of configData = [ ] array.


      image 1.png


      Test Your Project:


      After enabling the Raspberry PI system please take a moment to review the Raspberry Pi I2C Python step steps linked below. These steps will help you enable the I2C drivers on the Pi.

      http://www.instructables.com/id/Raspberry-Pi-I2C-Python/#step1


      image2.png


      Download the example python code from this post and run the code using the IDLE which is installed as part of the Raspbian image.


      Best,

      Matthew Buza

        • Re: CY3280-MBR3 Example with Raspberry Pi
          malakai

          The example doc link isn't working for me. Any chance you can check into it. Looks very interesting to use in various Raspberry Pi projects.

            • Re: CY3280-MBR3 Example with Raspberry Pi
              cy.gul

              Todd,

              here's a copy-paste of the contents of that example document:

               

               

               

               

               

              CY3280-MBR3CY3280-MBR3 example with Raspberry-Pi (ras pi) host.

               

              The python example code runs on ras pi Rev B board having Rasbian Wheezy Image.

              In this example code the Ras pi configures the MBR3 kit in default configuration i.e. all 4 buttons & corresponding LEDs and Water tolerance is enabled. The example code also reads and displays the button status on the python shell output.

               

              Details:

               

              Hardware:

              1. CY3280MBR3 Kit
              2. Raspberry Pi Rev B and its accouterments

                 

              Software:

              1. Ez-Click 2.0

               

              Example Code Overview:

              The example code configures the MBR3 device and reads the button status continuously in a thread. The read button status thread ‘readButtonStatThread()’ is updating a global variable ‘buttonStat’  that is used to in the main thread to display/print the status on the python shell.

               

              Raspberry-Pi:

               

              In this project RPi runs on Raspbian, a free OS based on Debian. The example code is written in Python which can be run using the already installed python (IDLE).

               

              Raspberry Pi Block Diagram:

               

              Raspberry-Pi P1 Header contains the lower-level interfaces, these pins uses 3.3 V and is not tolerant to 5V.

               

               

               

               

               

               

               

               

               

               

               

               

               

               

               

               

               

               

               

               

               

               

               

               

               

               

               

               

               

               

               

               

               

              Hardware Setup

               

              Hardware Connections:

               

              1. Connect the MBR3 I2C Lines from pin-2 of J13 and J14 jumpers to corresponding I2C lines of Ras pi available on P1 header.
              2. Connect the MBBR3 GND to Ras Pi GND on available on P1 header
              3. Power the MBR3 kit separately using the Mini USB cable

              Note: Don’t power the Kit from the 5V connection available on P1 header of the Ras Pi.

              1. Keep the Jumper J11, J12 shunted.
              2. Keep J15 jumper in “C” configuration i.e. Enable Buzzer and Water Tolerance enabled.
              3. If you want to enable different features just generate the 128 byte of configuration data using Ez-Click and replace the data of configData = [ ] array.

               

              Procedure:

              1. Set up the Raspberry SD card and get it running.
              2. Follow the step by step procedures mentioned at the link below to enable the I2C drivers

              http://www.instructables.com/id/Raspberry-Pi-I2C-Python/#step1

              1. Check if the hardware connection is as indicated above.
              2. Download/Copy the example python code and run the code using the IDLE which is already installed.

               

               

              Raspberry Pi References

               

              1. Raspberry Pi Low-level peripherals: http://elinux.org/RPi_Low-level_peripherals
              2. I2C : http://www.instructables.com/id/Raspberry-Pi-I2C-Python/#step1
              3. The keyboardinterrupt exception: http://effbot.org/zone/stupid-exceptions-keyboardinterrupt.htm
              4. Python Control Flow: http://docs.python.org/2/tutorial/controlflow.html
            • Re: CY3280-MBR3 Example with Raspberry Pi
              b4ux1t3

              This helped a lot with the project I am using for the RoadTest. I am currently writing a module that simplifies the commands and makes an EZ Click-esque interface to configure the MBR3 over I2C using the example code blow as a base, since there's no Linux support that I can find for EZ Click.