I wanted a beautiful piece of iron. Happened
Once beloved wife with friends in the country found a rainbow spring-loaded slinky . I remembered my childhood, walked up to the stairs and launched. Miracle, but the spring from the first time ideally propruzhinil on each step.
- Happened! - with joyful surprise exclaimed everyone who was near.
The three-year-old daughter also wanted to try. She took a spring, climbed the stairs and launched it. The spring flew over the stairs and slammed sideways on the grass.
- Happened! - joyfully shouted daughter.
A year has passed since the start of my fun project. Happened! That most beautiful piece of iron looks like this:
At first glance it may not be clear. But suppose it is an ax. And with the help of this ax and a few parts at the end I will make porridge.
And for a good porridge from the ax you need croup.
Everyone knows about ESP8266. This board has several differences.
- Troyka-modules are connected to it. And there are a lot of them different.
- Such modules can be put there 4.
- It has 8 ADC channels, with a range measurement from 0 to 3.3 V. And for the bare ESP8266 this is not very typical.
- There are two power buses: power 5V, digital-analog 3.3 V.
- One into the other turns through DC / DC. I personally zadolbali these boilers-regulators. Hi high efficiency.
- And this means that you can drive the motors straight from it. And somehow I'll show you how.
- It supports Slot Connector. And this is cool.
In short, I can stick 4 potentiometers into it, and it will look gorgeous. After all, for the sake of steep onions, everything was started.
And here is my favorite STM32F030F4P6.
In the picture there are two boards with the same i2cio firmware. This is an I / O port expander.
9 control pins of this thing can:
- 12-bit ADC
- 16-bit PWM, with a very cool adjustable frequency. At least hang the serfs (DC / DC helps here), even though the DC motors are cool, at least the sound is playable.
Also these 9 plus one more can digital input / output.
In addition, the Slot Expander supports Troyka connectors and power separation into power and analog parts.
Ahhh ... I forgot. Such extenders can be connected to the piece of iron a little more than 100 pieces. And they are all sorted into I2C addresses automatically, providing flat pin addressing. That is, you can write
i2cio.digitalWrite(852, HIGH); int tooMuchForAnalogPinNumber_areYouReallyShureQuestion = i2cio.analogRead(942);
And at the same time everything will turn out.
Well, it costs 33 rubles a stone. And you can do with it, for example, a rider on the line with the largest number of grayscale sensors in the world. With 12-bit ADC and 16-bit sensitivity adjustment. Without changing the firmware.
That I will definitely show in the next series.
We go further.
A friend asked me to make him a remote for Traktor - a favorite program of the DJs. I thought that if I couldn’t manage to do this quickly and beautifully, then I was nonsense, and not a beautiful piece of hardware.
Twist everything together
Note: hereinafter it is understood that the text above has never been
For this, I need an esp8266 motherboard with a brain ( left ). It differs from the others only in that it is square, has 8 ADC inputs and is powered from 5 V through a DC / DC converter. And you can also connect the same square expansion card on my favorite stm32f030f4p6 ( right ) through a beautiful piece of iron ( center ) to it.
Add a bunch of potentiometers
One more feature of these pieces of iron - it is very simple to insert standard modules into them. I have many different modules. I took a bunch of potentiometers. Because everyone loves a bunch of potentiometers (s).
More potentiometers to god potentiometers!
The longest assembly point. If you want to do everything exactly like me, you need to do the following:
- Buy in Leroy wooden corner with a side of 2 cm
- Take a saw and try to cut it off at 45 degrees
- Understand that this is not so easy. Start running everywhere and look for a barrels.
- Twist the bar out of the Soviet metal constructor.
- To cut almost the whole corner into a marriage, because it is not given to you, Vasily, to do something beautiful with your hands.
- Buy finally a bargain.
- GOTO 5. Because it is not given to you, Vasily. Nothing to try.
Here's what happened:
Nonsense to remake
A friend says: “This is what it is, the remote for the tractor, right? It doesn't look like something. ”
Good job. Start over.
We take 4 more expansion cards, fasten. We take a bunch of moduli, and poke anywhere.
It turned out this:
Carefully drill a hole for the Micro-USB connector to program the motherboard and, subsequently, charge the battery.
Oh, not given to you, Vasily, not given ...
Demonstration of work
The result was a wireless remote for the tractor. He controls the tractor over WiFi via Open Sound Control.
Source code on gitHub . Filled the entire working folder, so as not to search for libraries all over the Internet.
How does it work?
A beautiful piece of hardware is just a connector, which with the help of four bolts can transmit two signals and power. The two signals are I2C. The motherboard is able to scatter all expansion cards to successive I2C addresses and, subsequently, to do something with them. For example, read a 12-bit analog signal from (almost) each leg of the extender. Or control the 16-bit PWM on each leg of the expander. Well, or just use these legs as a digital input / output. You can use these extenders if you simply do not have enough legs on your favorite microcontroller.
Firmware stm32f030f4p6, installed on the expansion card is here .
The library for working with port extenders in the Arduino IDE is here .
If it will be interesting to dear habravchanam, I will surely tell about it in more detail. But not today.