background preloader

WiringPi

WiringPi

Everything You Want to Know About Raspberry Pi GPIO: But Were Afraid to Ask • Circuits Introduction to the Raspi GPIO This article focuses on the Raspberry Pi’s with the 40 pin GPIO connector. In addition to the familiar USB, Ethernet and HDMI ports, the Raspberry Pi offers the ability to connect directly to a variety of electronic devices. These include: Digital outputs: turn lights, motors, or other devices on or off. Digital inputs: read an on or off state from a button, switch, or other sensor. On the Raspberry Pi’s with the 40 pin connector, 28 of the pins are available as GPIO. The Raspberry PI GPIO’s use 3.3V logic levels and are directly connected to the Microprocessor chip. The following Raspberry Pi models have the 40 pin connector available on the circuit board: Raspberry Pi Zero Raspberry Pi Zero W Raspberry Pi Model A+ Raspberry Pi Model B+ Raspberry Pi 2 Model B Raspberry Pi 3 Model B The pin header is marked J8 on the circuit board, and arranged as 2×20 pins with a pitch of 2.54mm. So what do these pin numbers and names mean? Power pins information WiringPi

Why GPIO Zero Is Better Than RPi.GPIO for Raspberry Pi Projects Advertisement The Raspberry Pi is the perfect computer for learning. The Linux-based Raspbian OS has Python built in, which makes it a great first system for beginner coders. Its General Purpose Input/Output (GPIO) pins make it easy for budding makers to experiment with DIY electronics projects. It’s especially easy when you use code libraries that control these pins, and the popular RPi.GPIO Python library is an excellent example of such a library. But is it the best path for beginners? What Is GPIO Zero? The GPIO Zero library is a Python library for working with GPIO pins. Combining simple naming practices and descriptive functions, GPIO Zero is more accessible for beginners to understand. What’s Wrong With RPi.GPIO? Nothing. Despite its extensive use, RPi.GPIO was never designed for end users. What’s So Good About GPIO Zero? When you are learning Python code, you learn that it should be easy to read and as short as possible. GPIO Zero has a module for LEDs, imported at the start.

Raspberry Pi’s GPIO Speed | Olli's We all know that the raspi is a small and neat device for controlling our LEDs but sometimes I miss the possibility to add hardware to a “real” bus like a real CPU has. Sure it is possible to imitate a bus what is called bit banging. This way you can control external hardware like LCDs or writing data to external SRAM faster than utilizing SPI. So we were interested how fast the Pi can really switch these pins. There are some benchmarks out there but I tried to find the real limit. C code with inline assembler for switching GPIO pin 17 Here is the result: As you can see, this code is able to switch it at 25 MHz and the the curve looks quite good. hzeller/rpi-gpio-dma-demo: Performance writing to GPIO with CPU and DMA on the Raspberry Pi

Accessing The Hardware PWM Peripheral on the Raspberry Pi in C++ · Hertaville.com In this Blog entry I will demonstrate how to access the single hardware pulse width modulation (PWM) channel available on the Raspberry Pi. The BCM2835 SOC on the Raspberry Pi has two PWM peripherals; PWM1 & PWM2. Only the PWM1 peripheral can be mapped onto a GPIO pin (GPIO18) available on the RPi's 26-pin header. It's important to note that both the PWM1 & PWM2 peripherals are used by Raspbian to generate audio, so make sure that the RPI is not generating audio while accessing the PWM peripherals. Since Raspbian/ Linux already assigns the PWM peripherals for audio generation, there's strictly no direct 'proper' way to access the PWM1 peripheral from userspace without accessing the hardware registers directly by 'mmaping into /dev/mem'. The rpiPWM1 Class I developed C++ class 'rpiPWM1' that maps the PWM1 peripheral to GPIO18 and is able to control the PWM frequency, resolution, duty cycle and mode with ease. Here's example code on how to use this class: Setting the PWM Frequency

Add Analog to Digital Conversion Capability to The Raspberry Pi Without an ADC Chip · Hertaville.com One of the few disadvantages of the Raspberry Pi is that it lacks a built-in analog to digital converter(ADC). This can be remedied by connecting a dedicated ADC chip to the RPi Board via SPI (or even I2C). But there are other ways to get analog to digital conversion going on the Raspberry Pi. This entry demonstrates how to add analog to digital conversion capabilities to the Raspberry Pi with a few external components (a comparator, two resistors and a capacitor) and some software. The entire process is summarized as follows: The PWM1 peripheral in the Raspberry Pi is used as a digital to analog converter (DAC) with the aid of a simple passive RC filter. This 'hack' is not new and has been used many times with microcontrollers that lacked built-in ADC's, but had PWM generators. The schematic for the circuit is shown below. Basic ADC Hack schematic Using the RPi's PWM output as a DAC To understand how a PWM peripheral can be used as a DAC, consider the three waveforms below: The Code

□ Reaching 80MHz One of the key design goal of periph.io is to be as fast as possible while exposing a simple API. For GPIO pins, this means having reliable low latency in the happy path. In this article, we’ll describe how we: wrote a reproducible benchmark for GPIO that can be used across platforms, which measures output performance by toggling the output low and high continuously as fast as possible ⎍⎍⎍⎍ and for input performance by, unsurprisingly, reading continuouslyoptimized outputs and inputs against the benchmarksdetermined incorrect optimizations and benchmarking issuesdetermined performance anti-patterns Are we fast yet? Why micro-optimize the GPIO to be as fast as possible? Bit banging, which can be used to emulate a protocol.Software based PWM or Servo.Software-based best-effort logic analyzer.Using as little CPU overhead for devices on CPU bound operation especially in the case of single-core platforms like the Raspberry Pi Zero and the C.H.I.P. All builds were done with Go 1.9.2. Methodology

Raspberry Pi 2 vs. 1 GPIO Benchmark | Code and Life It’s battle time! Some of you may have heard that Raspberry Pi 2 is out with more punch than ever. Just how much more? Well, apt-get dist-upgrade went about 5 times faster with the new Pi. But what about hacking? Summary of results All the Pi 1 benchmarks were ran 14th and 15th February 2015 using latest versions of the libraries as stated in my updated benchmark post. Raspberry Pi 2 GPIO Issues It seems that not all code has yet caught up with the new version. #define BCM2708_PERI_BASE 0x3F000000 Ruby bindings for wiringpi (or wiringpi2) did not work at all for unknown reasons, possible due to the above change, or something else. #define BCM2708_PERI_BASE 0x20000000 Conclusions Based on the benchmarks, the Pi 2 is generally 2-3 times as fast in GPIO operations too as its predecessor. Published by Joonas Pihlajamaa Coding since 1990 in Basic, C/C++, Perl, Java, PHP, Ruby and Python, to name a few.

Faux-Real Contest Sponsor. The Instructables Faux-Real Contest (the "Contest") is an online contest with skill, ability and knowledge components that is sponsored by Autodesk, Inc., a Delaware corporation having its principal office at 111 McInnis Parkway, San Rafael, CA 94103, USA ("Sponsor"), in connection with the Instructables service and website, www.instructables.com, (the "Sponsor Site"). The Contest is co-sponsored by the company or companies listed here, if any (each, a "Co-Sponsor"): The Contest is governed by these Official Rules (these "Rules"). For any questions regarding the Contest, the Sponsor may be contacted by email at [service@instructables.com] or by mail at the address identified in Section B.16 ("Winner's List; Mailing List") below.Overview; Object of the Contest. If a stated prize is unavailable, as determined by Sponsor in its sole discretion, Sponsor has the right to substitute one or more items of equal or greater value, in its discretion. Judging.

PiScope (Raspberry Pi Based Oscilloscope): 10 Steps AdWords We use AdWords to deploy digital advertising on sites supported by AdWords. Ads are based on both AdWords data and behavioral data that we collect while you’re on our sites. The data we collect may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, and your IP address or device ID. This information may be combined with data that AdWords has collected from you. LiveRamp We use LiveRamp to deploy digital advertising on sites supported by LiveRamp. Doubleclick We use Doubleclick to deploy digital advertising on sites supported by Doubleclick. RocketFuel We use RocketFuel to deploy digital advertising on sites supported by RocketFuel. Twitter We use Twitter to deploy digital advertising on sites supported by Twitter. Facebook We use Facebook to deploy digital advertising on sites supported by Facebook. Sprinklr We use Sprinklr to deploy digital advertising on sites supported by Sprinklr. Dstllery Marin LinkedIn Demandbase Yandex AdForm Baidu Naver

Raspberry Pi Oscilloscope | Test, Measurement and Data Acquisition for Raspberry Pi. Issue 71 We learn how to get Android up-and-running on a Raspberry Pi. Turn your Raspberry Pi into a touchscreen device, install apps, and control electronics. Plus! Build a fully working weather station that tracks temperature, rainfall, and wind speed/direction. Buy The MagPi from these stores All this inside The MagPi 71 Build your own oscilloscopeLearn Pygame Zero – part 1Discover remote access via VNCConstruct a Raspberry Pi wildlife cameraPi-hole: block adverts across your whole network Need more details? You can buy The MagPi in all good newsagents, as well as high street stores, including: WHSmithTescoSainsbury’sAsdaBarnes & NobleMicro Center The MagPi is freely licensed under Creative Commons (BY-SA-NC 3.0). You can download this issue free now and forever, but buying in digital & print supports the Raspberry Pi Foundation’s charitable mission to democratise computing. Errata Spotted an error in The MagPi? Page 77, Build a Weather Station.

Related: