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
Raspberry Pi
  • Products
  • More
Raspberry Pi
Raspberry Pi Forum What gets in the way of your Raspberry Pi project?
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Raspberry Pi to participate - click to join for free!
Featured Articles
Announcing Pi
Technical Specifications
Raspberry Pi FAQs
Win a Pi
Raspberry Pi Wishlist
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 71 replies
  • Subscribers 674 subscribers
  • Views 17888 views
  • Users 0 members are here
  • pico
  • projects
  • raspberry pi
  • zero
  • introduction
Related

What gets in the way of your Raspberry Pi project?

cstanton
cstanton over 3 years ago

For those following along, it's become a bit of a daisy chain...

It's been about 10 years since the Raspberry Pi was released to the world, and I remember everyone being excited. It was a mixture of miscommunication, promises and new technology. An affordable embedded computer that was the size of a credit card. A lot of heated debate about open source and availability, and plenty of marketing. It hit off very well, and everyone clamored to get one, and somewhat still do, and support it. With open source libraries, packages and Linux, quite the contrast to similar boards released around the same time - I think it says a lot when someone has a project and decides 'no, this is how you do it' and leads with a direction and decision and doesn't leave it open for the herd of cats.

Still, a lot of people I know have a collection of Raspberry Pi, and the meme goes 'Yes I have one, it's sat in my drawer collecting dust, I don't know what to do with it' or 'I use it for my media server... and that's about it'. While using a Raspberry Pi as a media server is not a bad thing, it's rather justified (and frankly has spun off a lot of similar products since) it's not the only thing to use a Raspberry Pi for.

Now there's a lot of accessories available, a lot of example code (like other microcontroller boards) but there still must be something about it that trips you up when creating that project. Is it limitations with the hardware? (it is mostly 3v3 after all) or is it the physical size of it? (the compute module, pico and zero start addressing this) well right now it's obviously the availability (or lack) of it, but we can't address that right now, so let's focus on what we do with it when we have one.

We're looking at expanding our content and what we ask from Raspberry Pi (Foundation/Trading) to govern our campaigns and content on the Community, and I'm interested in what you need help with, so reply and let us know, regardless of knowledge level or what you've been doing.

  • Sign in to reply
  • Cancel
Parents
  • scottiebabe
    scottiebabe over 3 years ago

    I think the largest barrier for me is the fear/interest/time on learning something new. Taking Jan's roadtest as an example, I would have no problem using a Pi hat where the software is supplied. But, if I wanted to make my own custom Hat and develop my own software I have no idea where I would even start.

    Both of the new RPI products the zero 2w & Pico are pretty amazing for endless number of projects.

    • Cancel
    • Vote Up +4 Vote Down
    • Sign in to reply
    • Cancel
  • shabaz
    shabaz over 3 years ago in reply to scottiebabe

    Start here on element14 : )

    Here's an approach. Firstly, there's only about 4 types of interface available on the PI, so you'd design your circuit as normal, and attach to the interfaces (3.3V logic levels):
    (a) GPIO
    (b) I2C
    (c) SPI
    (d) UART

    Interface (d) I'd avoid where possible because it comes in handy as an emergency serial console into Linux.

    Next step, is to decide on programming language (you could even combine different languages). If you want good speed and similarity to Arduino, then a good choice is C. Otherwise, Python. I'll discuss the C option only here:

    For the different interface types (a) to (d), if it were me, then I'd follow these paths:

    (a) Use WiringPi library - it used digitalRead etc just like Arduino
    (b) I'd use my I2C library, I've not found anything simpler, and although there may be bugs, it has worked so far at every I2C chip I've tried, and it is quite flexible. The I2C library is here (you just need the files called i2cfunc.c and i2cfunc.h) 
    Note that if you are using it with Pi 4, then the definition for I2C_BASE needs changing in the header file, from 0x3f804000 to 0xfe804000 - this could be done in code automatically depending on Pi type, I just have not got around to implementing it. It's low-pri for me so I have not done it.
    (c) For SPI, examine a file called spidev.c (google'able) and copy that, it works well : )
    (d) I don't use UART for reason mentioned : )

    Note that for (b) and (c), I've not discussed any specific chips like temperature, I/O expanders, etc. That's because generally it is easy to see from the chip datasheet how to control it, and then I'll write my own code. Especially for chips that just need one-way communication, it can be extremely trivial. For instance, with the LCD code here (which isn't for the Pi, but the principle is the same), writing to an LCD screen is as simple as:

    void
    lcd_print(char* str)
    {
        char data[2];
        data[0]=0x40;
        while(*str != '\0')
        {
            data[1]=*str++;
            i2c_write(data, 2);
        }
    }
    

    It's not worth finding an I2C library for an LCD when it is this trivial.

    I've not addressed the EEPROM that HAT boards used, that should be documented on the raspberrypi.org website, but it's not essential for any custom board you create. It is not of much importance for projects where you know what boards are plugged in.

    Regarding power, the Pi board has 5V and 3.3V outputs on the header pins, so you could use those (within reason) or power from an external supply.

    • Cancel
    • Vote Up +5 Vote Down
    • Sign in to reply
    • Cancel
Reply
  • shabaz
    shabaz over 3 years ago in reply to scottiebabe

    Start here on element14 : )

    Here's an approach. Firstly, there's only about 4 types of interface available on the PI, so you'd design your circuit as normal, and attach to the interfaces (3.3V logic levels):
    (a) GPIO
    (b) I2C
    (c) SPI
    (d) UART

    Interface (d) I'd avoid where possible because it comes in handy as an emergency serial console into Linux.

    Next step, is to decide on programming language (you could even combine different languages). If you want good speed and similarity to Arduino, then a good choice is C. Otherwise, Python. I'll discuss the C option only here:

    For the different interface types (a) to (d), if it were me, then I'd follow these paths:

    (a) Use WiringPi library - it used digitalRead etc just like Arduino
    (b) I'd use my I2C library, I've not found anything simpler, and although there may be bugs, it has worked so far at every I2C chip I've tried, and it is quite flexible. The I2C library is here (you just need the files called i2cfunc.c and i2cfunc.h) 
    Note that if you are using it with Pi 4, then the definition for I2C_BASE needs changing in the header file, from 0x3f804000 to 0xfe804000 - this could be done in code automatically depending on Pi type, I just have not got around to implementing it. It's low-pri for me so I have not done it.
    (c) For SPI, examine a file called spidev.c (google'able) and copy that, it works well : )
    (d) I don't use UART for reason mentioned : )

    Note that for (b) and (c), I've not discussed any specific chips like temperature, I/O expanders, etc. That's because generally it is easy to see from the chip datasheet how to control it, and then I'll write my own code. Especially for chips that just need one-way communication, it can be extremely trivial. For instance, with the LCD code here (which isn't for the Pi, but the principle is the same), writing to an LCD screen is as simple as:

    void
    lcd_print(char* str)
    {
        char data[2];
        data[0]=0x40;
        while(*str != '\0')
        {
            data[1]=*str++;
            i2c_write(data, 2);
        }
    }
    

    It's not worth finding an I2C library for an LCD when it is this trivial.

    I've not addressed the EEPROM that HAT boards used, that should be documented on the raspberrypi.org website, but it's not essential for any custom board you create. It is not of much importance for projects where you know what boards are plugged in.

    Regarding power, the Pi board has 5V and 3.3V outputs on the header pins, so you could use those (within reason) or power from an external supply.

    • Cancel
    • Vote Up +5 Vote Down
    • Sign in to reply
    • Cancel
Children
  • scottiebabe
    scottiebabe over 3 years ago in reply to shabaz

    You have me convinced this is a skill I need to add to my repertoire. In the limited time I have played with my pi zero 2w, I have been impressed its a pretty capable device (essentially a Pi3) and I could run it off an ordinary dollar store 5V/1A powerbank.

    I tired using the hardware pwm output using the pigs gpio library and it worked well enough. As a noobie to PI hardware is pigs the new way of gpio or just another I wasn't really sure? The piscope is pretty cool you can see any of the GPIO pin states even if they are being driven by a hardware peripheral.

    Looking to the future I assume the PI designers are cooking up a new chip to replace the broadcom SoC. I hope they target something like the zero2w but maybe a little lower price and a RP2040 in shared memory on die too. I don't personally need a 16 core raspi for $200, though I'm sure there are millions who would love that. Have to wait and see....

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • colporteur
    colporteur over 3 years ago in reply to scottiebabe

    I've used three different libaries to access the Pi's GPIO's over the years. I first started with RPi.gpio, then gpiozero and most recently pigpio. I liked gpiozero but the latest version referenced pigpio as the ideal solution for supporting servo's. I would prefer to one-stop-shop and not have to jump between different libraries to accomplish a task. My programming skills are not strong so learning and relearning are taxing.

    Your programming skills are much stronger than mine. You might find more benefit in pigpio than the others. The library is strongly invested in remote capabilities. That is something nice to have in your toolbox.

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • Cancel
  • scottiebabe
    scottiebabe over 3 years ago in reply to colporteur

    Thanks for the kind words and advise. The pigpio looks like a pretty powerful library, as it will bitbang any gpio pin via dma to create a pwm output. Or will send pin change notification via a linux file pipe.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • shabaz
    shabaz over 3 years ago in reply to scottiebabe

    I've not used that library or hardware PWM on the Pi so far. One thing worth checking with any library is if they are using hardware register accesses for GPIO, or Linux device files (/dev), because the latter is slow. Sometimes I'll write code and attach hardware differently with Pi compared to if I were using a microcontroller, simply to work around issues, or to accommodate the level of real-timeness that is practical with Linux in user-space code. For instance, I can reduce the number of inputs I poll, by using a single pin with all inputs OR'd, that way the code is speedy until I need to read a specific pin (for example). With a microcontroller that would be less necessary although it can still be handy. Also, I/O expanders can be handy since I2C or SPI is a very solved problem for any Linux SBC, and will run fast from your user-space code since it uses the I2C/SPI device drivers.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
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