element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Sci Fi Your Pi
  • Challenges & Projects
  • Design Challenges
  • Sci Fi Your Pi
  • More
  • Cancel
Sci Fi Your Pi
Blog Quick Update on the QuadCop and the ChipKit Pi
  • Blog
  • Forum
  • Documents
  • Files
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: screamingtiger
  • Date Created: 1 May 2015 4:22 AM Date Created
  • Views 456 views
  • Likes 3 likes
  • Comments 0 comments
  • quadcop_project
  • design_challenge
  • chipkit_pi
  • sci_fi_your_pi
Related
Recommended

Quick Update on the QuadCop and the ChipKit Pi

screamingtiger
screamingtiger
1 May 2015

Other posts on my project:

http://www.element14.com/community/tags#/?tags=quadcop_project

 

I am working on a real update for my project.  I have several parts connected up and nearly 1000 lines of C code written for my arduino and my Raspberry Pi2.  I have some things to demonstrate and some explanations to do.

 

I decided to take a tangent and work with the ChipKit Pi.  I remember a few years back I wanted a Chip Kit UNO because it was a 32 bit processor that is much faster than the AVR used in the Arduino, however I never got around to it.  I didn't recognize what Element14 had sent me until I looked at it closer!  I am very excited to own one of these.

 

I have been testing some code on an Arduino nano328 to read my radio's PWM signals and communicate via I2C to my Raspberry Pi2.  Things are working great so I spent some time seeing if I can get the same code to run on the ChipKit.  The code compiled with minimal changes.  I used the MPIDE on the Raspberry pi to compile it.

 

As a quick test, I ran a simple speed test on all 3 parts involved and here is a video outlining my results.  This is the FIRST video blog I have ever done so bare with me, they will get more polished over time.  Watch the video and read some more comments below.  I kept wanting to call the ChipKit Pi the ChipKit UNO so you will hear me pause every time I say it.

 

https://www.youtube.com/watch?v=4tPfn6qDRAs&feature=youtu.be

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

 

To summarize:

ChipKit Pi:  98ms

Arduino Nano: 4350ms

Raspberry Pi 2: 15ms

 

Notes

Phantom I2C objects

Serial pins are different for uploading sketches and for viewing output from Serial.print statements.

Wire.read() is Wire.receive() in the ChipKit version.  I commented the wire parts out int eh CHipKit Pi code below.

I am not certain the MPIDE is turning on compiler optimizations.  Will research.

Speed increase of the ChipKit Pi:  44.3 times faster.

The Raspberry Pi2 is 6.5 timers faster than the ChipKit pi, and 290 times faster than the Arduino.

 

Keep in mind this is just a purely simple processing test and ignore I/O  and other functionality.

 

PS:  QuadCOP parts get tomorrow, the FUN stuff including all the motors and the frame!  Should be able to do a test flight (manual, no pi etc.) this weekend.

 

 

 

Raspberry Pi Code (use time command to get results):

 

#include <stdio.h>

int main()
{
        int a;
        int b;
        b = 1;
        int l1 = 100;
        int l2 = 10000000;

        for(int i=0;i<100;i++)
        for(a = 0;a <=3000;a++)
        {
                b = b +  a;
                b = b * 2;
                b = b % 1657;
        }
        printf("Result: %d\n",b);
return 0;
}

Arduino Code: (spits out information on serial)

#include <Wire.h>
int lastAnswer;
void receiveEvent(int howMany)
{
}
void requestEvent()
{
  Wire.write(lastAnswer); // respond with message of 6 bytes
                       // as expected by master
}

void setup()
{
        Wire.begin(4);                // join i2c bus with address #4
        Wire.onReceive(receiveEvent); // register event
        Wire.onRequest(requestEvent);
        Serial.begin(9600);
}

void loop()
{
        Serial.println("starting test");
        unsigned long ms = millis();
        int a;
        int b;
        b = 1;
        int l1 = 17;
        int l2 = 3000;

        for(int i=0;i<100;i++)
        {
        for(a = 0;a <=3000;a++)
        {
                b = b +  a;
                b = b * 2;
                b = b % 1657;
        }
        }
        lastAnswer = b;
        ms = millis() - ms;
        //printf("Result: %d\n",b);
        Serial.println("test completed");
        Serial.print("Answer: ");
        Serial.println(b);
        Serial.print("Time: ");
        Serial.println(ms);
}

 

 

 

 

 

Chip Kit Pit code:

int lastAnswer;
void receiveEvent(int howMany)
{
}
void requestEvent()
{
  //Wire.write(lastAnswer); // respond with message of 6 bytes
                       // as expected by master
}

void setup()
{
        //Wire.begin(4);                // join i2c bus with address #4
        //Wire.onReceive(receiveEvent); // register event
        //Wire.onRequest(requestEvent);
        Serial.begin(9600);
}

void loop()
{
        Serial.println("starting test");
        unsigned long ms = millis();
        int a;
        int b;
        b = 1;
        int l1 = 17;
        int l2 = 3000;

        for(int i=0;i<100;i++)
        {
        for(a = 0;a <=3000;a++)
        {
                b = b +  a;
                b = b * 2;
                b = b % 1657;
        }
        }
        lastAnswer = b;
        ms = millis() - ms;
        //printf("Result: %d\n",b);
        Serial.println("test completed");
        Serial.print("Answer: ");
        Serial.println(b);
        Serial.print("Time: ");
        Serial.println(ms);
}

  • Sign in to reply
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube