[DIY] How to Make a FPGA-based Electric Composer

June 28th, 2016

audio-wing2

Hello FPGA enthusiasts! Today’s project takes sound production using FPGA to another level. The project under focus is building an electric keyboard/composer using FPGA. The keyboard acts as a song tune composer where a network of switches on the FPGA board is connected in precedence such that while a switch is on, the corresponding note plays.

The major hardware components needed are just a FPGA board (you may need  to adapt this project to your own board), a speaker capable of playing a wide range of frequencies, and not just a monotone, and an auxiliary cable or suitable wires for connecting the speaker to the FPGA board.

The coding has been done using Xilinx ISE in the VHDL (.vhd). The author has given a detailed pin assignment as well as a basic VHDL background explanation. The code has been shared from step 5 to 9 and each module has been well explained by the author. The modules basically consist of a frequency division for playing different frequencies of sound and process statements for fixing parameters like precedence and sensitivity.

Setting the port map and executing the program has been explained in steps 10 and 11. By switching different switches you get different tones, though combinational tones cannot be made since precedence is followed.

The show must go on!

By krosenfeld7

How to Synthesise Music with YM 2151

June 23rd, 2016

tumblr_m9uu4ior111rsz87f

Hello FPGA lovers! Today we are going to share another instalment of our YM 2151 post series.

According to the author of the original article (in Spanish), the best way to produce sound using the YM 2151 is to use the 6809 assembler which is a cross targeting assembler seen usually in Motorola and Hitachi Devices. The author has made use of a MAME or a Multiple Arcade Machine Emulator which is the best platform for recreating arcade hardware since conventional FPGA Tools are unavailable for this project (in Spanish).

The author has simulated a project in MAME and has shared the code and registry values along with its explanation. This is more than a blessing in disguise since there is very little documentation regarding the actual simulation and synthesis of sound with the YM 2151 available on the Internet.

The Registry values, name and a short description regarding the function of each register is given in a comprehensive table by the author. The most important of these registry value combinations are:

  • Registry $60- $7F with Value $ 00 for volume.
  • Registry $20 with value $C for Left Right output control.
  • Registry $48 with value $4A for the notes and transposing it through octaves of 8 notes

Though there are a number of other registers given by the author of equal significance, the most important of these is the above quoted three registers as they play a pivotal role in sound production.

The author has also shared the asm 6809 assembler code. The table of registers executed in the code (in Spanish) can however produce a sound just once. To repeat these sounds and modulate frequencies to get a set of notes to play actual music might seem a bit tedious as there will be a need for repeated execution of the source code with some variations in registry values to produce different sounds.

 

By Jotego

Using the YM 2151 for Noise Generation

June 21st, 2016

tumblr_m9uuf0wzKx1rsz87f

Hi there FPGA lovers! Here we have another release of our series of YM2151 posts.

To recreate the YM 2151 in FPGA using VHDL, every aspect of the YM 2151 needs to be mapped on to the recreation platform. However an interesting aspect regarding the YM 2151 is that it uses random values for generation of noise (in Spanish) sound outputs like shocks, explosions and other disruptive sounds. While a general range of the signals used to generate this noise can be sampled, the YM 2151 has close to 18 bits for random signal generation which leads to a total of 218 signals.

The YM 2151 however uses a Linear Feedback Shift Register for this random sequence generation, and this considerably narrows down the possibility from more than a hundred thousand samples to a very narrow range. The output noise sequence can be predicted because of the feedback element, as every feedback signal can only have one selected output.

The MAME Source code for the emulator consists of a code for generating noise. This code has been used by the author to share a set of 256 samples. Though the samples appear to be seemingly random at first, a definitive pattern can be decoded from the samples depending upon the feedback given.

The Berlekamp- Massey Algorithm was used by the author to conclude that a definite relationship exists between the feedback and generated sequence for all bits except 0 and 4, contrary to the assumed 0 and 8 in the beginning. However the fact that the outputs after 0 and 4 cannot be predicted leads to the fact that there might be more than 218 samples. Thus from a set of more than hundred thousand random signals to generate noise in the YM 2151, the author has narrowed down the  possibility to a handful of feedback signals which can be used to create the clone of YM 2151 in Verilog for FPGA.

 

By Jotego

Understanding the YM 2151- YM 3012 Relationship

June 16th, 2016

2015-01-03-09-57-35

Hi FPGA lovers! In our conquest to find studio quality sound, we stumbled upon the YM 2151 FM Synth Chip which has been used by Yamaha from time immemorial in a number of their electronic keyboards and arcade games. The YM 2151 has a Digital output rather than an analog output and this makes it ideal for further signal processing using DSP. However due to the absence of an on chip DAC, the YM 2151 needs a suitable DAC chip that does not add substantial noise while analog reconstruction.

Today’s post is a detailed study of the YM 2151 and its coupling with YM 3012 DAC which are almost like inseparable siblings of the Yamaha family. The YM 2151 is a 24 pin IC which gives a 16 bit output.  The first 3 bits have no significant value, whereas the next 10 bits in order are the significant bits or mantissa and the last 3 bits are the exponents. The author has conducted a number of measures for a fixed value of supply voltage and has shared the results in his post.

The 3 parameters of concern are “d”, “n” and “m” which are the value of mantissa, exponent value and size of LSB respectively. The output voltage of the chip is given by a fixed relationship between these parameters where Vout= m*d + n.

From this result, the Verilog code for YM 3012 in the post starts making sense. The code has been designed around the fact that the base voltage is Vdd/2. However no explanation was given as to why this particular voltage was chosen. From this result, we deduce that Vdd/2 is the principle value because it supports maximum swing in positive and negative directions. This way the 10 bit resolution of the mantissa can be put to full use to produce the desired harmonic frequencies of high quality and clarity.

This is the reason why the YM 3012 DAC is best for this Synth chip, because it is essentially the second half of Yamaha’s FM Synth Chip design. The chip has been broken into two parts (the 2151 and 3012) to give the benefit of getting a 16 bit Digital output for further processing before reconstruction of the analog signal.

This makes the YM 2151 perfect for creating sound boards. The YM 2151 can be used in combination with a FPGA to recreate any themes. The FPGA adds a degree of flexibility in the chip’s output since the output of the YM 2151 is digital and can be easily processed by the FPGA.

 

By Jotego

Create Studio Quality Sound with YM 2151 and FPGA

June 14th, 2016

https://youtu.be/JSfBxKBUdKk

Hello FPGA lovers! Today’s post is about making real studio quality music rather than the monotone buzzers from conventional circuits. FPGAs can be used to create monotone sounds such as beeps by using the right combination of DACs and buzzers. However these devices cannot be used to create studio quality sound that not only plays over a harmonic range of frequencies but also sounds professional to hear. The YM 2151 FM Synth chip is one chip that can be coupled with the FPGA to create great sound and even tweak it to an extent by using the YM 2151- FPGA combination for driving the chip.

The Project in focus is the sound board of the arcade version of the popular game Double Dragon. The schematic for this project has been given by the author in the first post. The YM 2151 is a chip that outputs digital data, and as a result a DAC chip will be necessary before coupling the output to a speaker.

However, this digital output is a blessing in disguise since the output from the IC can be filtered for noise, adjusted for pitch variations and converted to almost any desired form with the FPGA. A Papilio Plus FPGA Board, a bread board, jumper wires, Arcade Mega Shield for Interfacing, PS2 Keyboard Controller, VGA Controller, Hexy module and the YM 2151 are the main hardware components you will need for this project besides a few other peripherals seen in the schematic.

The coding follows conventional VHDL (.vhd) for the Papilo FPGA that can be executed in Xilinx or similar software.  The code execution has been explained in detail in the second post in the thread along with 3 screenshots that shows the code execution and necessary plots. The code is available towards the end of the article.

No more excuses to keep playing with just beeps…!

By Alex

How to Build an Automated Intelligent Room Lighting System with FPGA

June 9th, 2016

https://youtu.be/k5gNt69FuBU

Hello FPGA lovers! The project in focus today is aimed at creating an Intelligent Room Lighting System with FPGA, where you can bid adieu to the use of switches! The system is powered by an FPGA board connected to a set of LEDs that turn on depending on the number of people in the room. This project has been designed for 8 LEDs, hence 8 people, and when there is no one in the room, the LEDs switch off themselves in 60 seconds.

The materials used for the project are a FPGA Board, 7 LEDs, 7 Resistors, Jumper wires, a micro USB cable and a breadboard. This implementation is a miniaturized model of the actual project, and the things you will need for that are relays, bulbs instead of LEDs, and sensors to detect the number of people in the room.

The author has divided the entire project into 5 modules, whose significance and role have been explained thoroughly from Step 3 to Step 8. This implementation uses the 7 segment display on the FPGA Board used by the author for the 60 second countdown. This saves the cost on buying and interfacing an additional 7 segment display on other FPGA boards, so you may need it. The project uses switches on the FPGA for determining the number of people in the room. This can be replaced with sensors for real scenario cases.

The author has attached a zip file containing the code for the project in Step 9. The code is written in VHDL (.vhd) and has been broken down into modules just like the steps in the project. The code logic is relatively simple to follow and can be easily modified to incorporate sensors and increase or decrease the number of lights in the room.

With the successful implementation of this project in reality, you can light up your room depending on the number of people in it, and completely forget about turning the lights on and off!

By RichardNLe

9 Steps to Create a LED FSM to Measure Power with FPGA

June 7th, 2016

F8F6Q5PIHS3RPMB.MEDIUM

Hi there FPGA geeks! Power monitoring is a big step when it comes to analysis and subsequent models used for power conservation. The project for today is building an FSM (finite state machine) with a LED as its output and FPGA as its core to measure the power output by the LED when it is active. The IR sensor detects motion and switches on an LED, whose power is measured by the board. This FPGA LED FSM project can be extended to real life scenarios such as measuring the power of fans and other individual electric components in the house to control and conserve power consumption.

The Hardware requirements for this miniaturized model are an IR motion sensor, a LED, a transistor, a FPGA Board and jumper wires. The black box diagram for the project is given in Step3. The wiring instructions are given in Step 8, and the description for the many modules used in this project have been given in the preceding step.

The code has been segregated into modules and has been written using VHDL (.vhd). The VHDL files are available for download from Step 5 along with the XDC master file necessary for the FPGA Board Port Map implementation, you may need to adapt this to your own needs. The code has been written in modules, and can be modified to measure power of any device connected to the board provided its consumption per second is known.

This project can only be used to measure the power consumption of a device for 15 seconds due to circuit limitations. However additional displays and clocks can be used to extend this time frame provided the code has been tweaked on properly.

By harlowchris

Build an Autonomous FPGA Search and Rescue Vehicle

June 2nd, 2016

https://www.youtube.com/watch?v=8plEwJMC69g

Hello again FPGA lovers! Today’s project is a challenging one where you build an autonomous search and rescue vehicle with FPGA! The projects involves the use of 2 vehicles, where one searches for the target with the aid of an FPGA, while the other uses minimal sensory aids to follow the search beacon and rescue.

The whole project has been divided into two steps, where the first step contains the hardware requirements. Apart from your FPGA, some of the other materials needed are an LCD screen, infrared thermometer, ultrasonic sensor, Dual DC motor drivers, logic converters, Rotary encoders and even a magnetometer. A detailed list of all used materials, their significance and connections are given in step 1 by the author.

The author has used VHDL (.vhd) for coding, and the code is available here. The zip file has been divided into the binary code and source code. You will find everything you need with detailed modules regarding each hardware part in the source code folder. The code can simply be uploaded onto the board and run for the search vehicle. The rescue vehicle directly follows the search vehicle and needs very little sensory aids.

The project’s documentation, presentation and source code is available here, and you can refer it for a detailed modus operandi of the project. This FPGA work is a combination of a number of interfacing techniques such as LCD with FPGA, DC motor drivers with FPGA and more. It is an apt project to test your mettle in the field of FPGA, and the result is truly worth the effort!

Enjoy!

By pcmihnea