Skip to content

AMPi Arduino Nano code to control ST7735 TFT Display and Rotary Encoder interface

License

Notifications You must be signed in to change notification settings

bjaan/AMPi-Display-Interface

Repository files navigation

AMPi-Display-Interface

AMPi is an audio receiver that integrates an amplifier with a mains electricity power supply, a 4-channel audio relay switcher, a ground loop isolator, a Raspberry Pi with a DAC-HAT, a ST7735-based TFT-display, and an Arduino Nano micro-controller.

It is an integrated audio system that combines 3 external analog stereo inputs and digital-to-analog converter that supports high-quality audio playback though wireless or wired local area network audio streaming (like AirPlay), and internet audio streaming (like Pandora.com), and personal area networks (Bluetooth 4.2) in one box less than 10 inches (250mm) wide, 4 inches (80mm) high, and 8 inches (190mm) deep.

This repository is the code for the Arduino Nano. For the software and code running on the Raspberry Pi, go to the AMPi-Service repository.

First prototype (WIP) with Raspberry Pi Model 3 and an Arduino Nano

Front Side (first prototype)

AMPi features

  • Mini size 250mm x 190mm x 80mm. Maxi sound
  • 2 channels x 100W (Stereo) Class D Audio Amplifier
  • Built-in internet audio streaming device with high-quality Digital-to-Analog Converter (DAC), e.g. 192KHz/24-bit FLAC
  • Built-in pre-amplifier
  • Input audio transformers functioning as a ground loop isolator. This allows for a full galvanic separation between external audio equipment and the DAC, and the amplifier section
  • Computer-controlled interface that controls the screen, manages the power of and the services running on the built-in audio streaming device
  • 3 switchable external analog audio input channels using a relay array through a rotary switch
  • Audio level indicator
  • Built-in mains power supply (100-230V)
  • AirPlay playback using Shairport Sync. AMPi identifies itself as a AirPlay network player, where your iPhone or iTunes on a Mac can be connected to, to play music. You can also use iTunes on Windows 10 to play music through AirPlay or route your audio to AMPi using TuneBlade
  • Bluetooth 4.2 Playback, this overrides everything and directly accessible after power-up
  • Quiet & high-quality upsampled to 192kHz/16bit Audio CD playback through generic USB CD/DVD drive (WIP). Breaths new life into the Audio CD format!
  • Pandora.com music player (WIP), using Pianobar

Front and back panel design (available in the .xcf and .docx documents):

Panel Design (WIP) PBackanel Design (WIP)

TODO / WIP

  • Front & Back Panel Label - with level indicators and indications what the knobs do
  • HDMI break-out cable to add in the back, needed for possibly external display or video streaming (currently shipping)
  • Raspberry Pi Software - further integration with the display interface component
  • Interface to enter Wi-Fi / LAN settings
  • Streaming software for Apple Music
  • Add CD Player interface for external USB drive
  • ...and more

Arduino Nano pin connections

Use a 3.3V/5V level shifter! - as this Arduino Nano runs on 5V, while the display & Raspberry Pi require both 3.3V

Display (Pin) Arduino Nano
GND (1) GND
VCC (2) 3.3V
SCK (3) D13
SDA (4) D11
RES (5) RST
RS (6) D9 (DC)
CS (7) D10
LEDA (8) 3.3V
Other Arduino Nano
Raspberry Pi Power Relay Signal D8
Rotary Encoder Clock D2
Rotary Encoder Data D3
Rotary Encoder Switch D4

Power connections

mains --- power supply +--- 24V --- DC/DC Converter +--- 12V --- Audio level indicator
                       |                            |
                       |                            +--- 12V --- DC/DC Converter +--- 5V --- Audio Relayboard --- 5V --- Audio Switch
                       |                                                         |
                       |                                                         +--- 5V --- Arduino Nano +--- 3.3V --- Display
                       |                                                         |                        |
                       |                                                         |                        +--- 3.3V --- Serial
                       |                                                         +--- 5V --- Power Relay for Raspberry Pi
                       |
                       +--- 24V --- open/closed Power Relay for Raspberry PI --- 24V --- USB Charger --- 5V --- Raspberry Pi -- 5V +--- DAC
                       |                                                                                                           |
                       |                                                                                                           +--- USB --- CD/DVD/Blu-ray drive
                       |
                       +--- 24V --- AMP Board

Audio signal connections

DAC --------+--- Audio Relayboard --- Audio Transformer Board ---+--  Bluetooth Relay (AMP Board) ---+--- Pre-Amp (AMP Board) --- Amplifier (AMP Board) -- Speakers
            |                                                    |                                   |
Analog 1 ---+                      Bluetooth Chip (AMP Board) ---+                                   +--- Audio level indicator
            |
Analog 2 ---+
            |
Analog 3 ---+

Software used

Arduino IDE

Settings

Tools > Board > Arduino NANO
Tools > Processor > ATmega328P (Old Bootloader)
Serial Monitor > 9600 baud

Installed libraries

These libraries were installed through Arduino IDE's Tools > Manage Libraries... menu:

Hardware parts used

Back Side (first prototype)

Tools used

  • Soldering iron & Solder
  • Rotary tool to cut & drill holes in the aluminium plates, back and front panel
  • Wire Cutters

Notes from the TFT Screen supplier

In German

LEDA kann auch an 5V doch dann wird das Display sehr schnell sehr heiß - was ich nicht für optimal halte.
Beim Betrieb mit 3.3V ist das Display nur minimal dunkler und bleibt kalt.
Die tft Funktionen kommen aus der Adafruit Grafik-Bibliothek (Adafruit_GFX) die möglichen Funktionen finden sich unter:
https://learn.adafruit.com/adafruit-gfx-graphics-library?view=all
https://cdn-learn.adafruit.com/downloads/pdf/adafruit-gfx-graphics-library.pdf

ST7735-Chip initialisieren (INITR_BLACKTAB)
Muss bei AZ-Delivery 1.77'' 160x128px RGB TFT INITR_GREENTAB sein ansonsten Pixelfehler rechts und unten.
Hinweis: https://github.com/adafruit/Adafruit-ST7735-Library/blob/master/examples/soft_spitftbitmap/soft_spitftbitmap.ino#L52
Zeile 52-65

About

AMPi Arduino Nano code to control ST7735 TFT Display and Rotary Encoder interface

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages