Not so long ago, I laid out to the public the device of its own design, which developed the last year. This is an internet radio receiver that works through wifi.
To vote for or against people is offered ruble, on the boomstarter. The device did not make a big furore, although sponsors already exist. But since then, there have been many technical questions and requests to lay out the scheme and firmware. All who are interested in how the device was born, and what is made of, welcome to kat.
there will be no firmware.
So, it all started with the need to have a radio in the kitchen at home. I, as an electronics developer, of course immediately broke the option just to go to the store and buy. By the way, for this reason, I still do not have a normal doorbell. FM radio has disappeared due to the boring implementation. And it was decided to do Internet radio. Looking ahead, I want to show that this is the kind of receiver that turned out here.
The choice of iron .
At first it was necessary to choose a platform on which it is possible to build an Internet radio. There are many options, but I chose from what was at hand:
1. Odroid W + LCD.
2. STM32F4DISCOVERY + ESP8266 + VS1053B
The development process would take less time, but the drawbacks, in my particular case (many will disagree with me), got the upper hand:
– OS boot process takes some time
– a growing tendency to infect IoT devices with viruses
– I have a poor knowledge of Linux development
– price
Nevertheless, I asked one of my good friends to write a softphone for Odroid W, which would run at the start of the system and would lose the Internet radio. But the impossibility of properly managing the project without jerking the comrade buried this option, and pushed me to the second.
And I assembled the following scheme on the layout:
How to work with Internet radio.
After that, I began to watch how the Internet radio works. It turned out that the vast majority of stations use icecast for broadcasting. It rotates somewhere on a server with a fixed IP, and waits for a connection. Usually on 8000 or 8080 port. Although there are many exceptions. After connecting, you need to send a request of this type, substituting the name of the stream and the server into it:
GET / stream HTTP / 1.1
Icy-MetaData: 0
User-Agent: Mozilla / 5.0 (X11; U; Linux i686; en-US; rv: 1.6) Gecko / 20040413 Epiphany / 1.2.1
Host: internetradioserver.ru
Cache-Control: no-cache
The endless mp3 stream begins to respond, which can already be decoded and reproduced.
The discovery of TCP connections and other joys of work With ESP8266 are carried out using AT commands. I will not stop at them, the information is full on the Internet. Very well all is painted in the Russian-speaking community esp8266. The procedure for working with it is simple:
1. We are waiting for the WiFi connection, if it is not selected, we enter the password.
2. Open the TCP connection to the radio station server. Server addresses, ports and thread names are stored directly in the flash memory of the microcontroller, but more on this later.
3. Send the GET request above,
4. We receive a continuous mp3 stream in response.
5. If you need to switch the station, close the TCP connection, and repeat from step 2.
I’ll tell you a little about how the stations get into the flash memory of the microcontroller. Initially, during the verification phase, I simply wrote down addresses, port numbers, and thread names in one of the program memory pages. But over time, when the devices went to relatives and friends, it was necessary to add the possibility of centralized updating of the list. It was decided to create a server with a fixed IP, which would store a file with a list of stations. When connected via TCP, the server waits for a password, and issues a file, and the microcontroller writes it to itself in flash memory. Since I first encountered the creation of “something on the Internet,” I was pleasantly surprised that it turns out that renting a virtual machine with a fixed IP costs only 100 rubles a month. Miracles:)
Circuitry.
Having played enough with STM32F4Discovery, I decided to make my motherboard on which all the elements of the receiver will be located, and no need to pull the wires either to the display To the connectors. This greatly improves reliability and manufacturability and everyone dreams about it .
The schematic can be downloaded here. [СХЕМА]. I did not decorate it and did not comb it specially for publication. This is the working version, and this should be enough for those who are really interested.
The scheme consists of the main parts:
1. MK STM32F415 with strapping-two quartz and a battery for real-time clock.
2. ESP8266
3. VS1053 c binding strictly on the datasheet. It is entered on MK through SPI.
4. Power supply – two linear regulators LM1117 at 3.3 and 1.8 volts.
5. Display, connectors, buttons, potentiometer. All this is on the GPIO of the microcontroller.
Also, the amplifier does not display the class D PAM8403 as it is a separate purchase module.
Fee.
On good, before making a payment, it is necessary to determine the location of elements protruding from the body – buttons, connectors, display. So I did, but about the case later.
The board turned out like this. Caution geek-strawberry!
The board is two-layered, the thickness is 1.5 mm. All smd components are located on one side, which facilitates automatic installation. However, it has not reached him yet.
Some experts were already peeking me at the piccab for minor flaws in the wiring. However, the board is working and working as it should. I do not see the value in the drawing boards so I do not spread. If there are requests, I’ll post it. All the same I will remodel. Well, of course, justified criticism is very welcome!
Corps.
The hull is the pain of all electronics enthusiasts. And even if you’re not an amateur, making a case for your money, you turn into it.
With small batches, the most affordable option is either milling or laser cutting. In metal versions, this can still be the bending of sheet metal, but this is not my case. Therefore, I chose milling of wooden parts + laser cutting panels. In terms of sound, the wooden case is also a huge plus.
The following set of details has turned out:
Inscriptions deserve special attention. After much thought, how to apply them, it was decided to perform them using the grouting method. That is, first a fine cutter inscription is selected on the panel, and then the paint is poured there. After the paint dries, its excess is removed. A very expensive operation, but I could not stop. In addition, one of the most durable methods. If someone has experience working with other methods of inscriptions, I ask to share.
This is how the resulting inscriptions look.
And this is how the assembled radio looks from the inside:
And one more photo outside:
Conclusion. This article described in broad strokes the details of the design of the device. It is rather difficult to write about the details, on the one hand by the fact that their sea, on the other hand, all of them individually seem obvious. I could write on a separate article devoted to circuitry, a printed circuit board, firmware, work with esp8266 and vs1053b, if I get enough interest, I’ll write it. For I really want Internet radio to become popular.