Someone would have thought that we could develop such a beautiful and clever girl ourselves. Not only that - not just working out on paper, but also getting a dozen working samples.
')
Picture To Attract Attention
Prologue
A long time ago, a colleague and I began to manage all kinds of things like webcams and small machines over the Internet. A little later, we had more serious devices that were able to carry a controller and a capacious battery on board. In addition, I became interested in all sorts of flying gizmos - airplanes and copters, which made an additional contribution to the list of women.
I didn’t leave the thought that it would be good to make a video not “side view or from above”, but view from the side of the device, from the first person. The fact that airplanes / kopterista called FPV. It was about a couple of years ago. Tried to put on a typewriter analog camera and transmitter, took the video to the TV tuner, then gave to the video server for distribution to the steering cars. But the nuances immediately surfaced - at the same time, only 3-4 video streams can be broadcast, otherwise, pickups from one channel to another appear. Plus, the high cost of such a solution, plus problems with resolved frequencies, plus lousy picture quality with constantly appearing interference ... In general, we tried and scored on this. In addition, the capabilities of the controlling controller (then everything was done on the basis of the well-known Arduinka) began to lack. They began to look for other options so that it was inexpensive, cheap, convenient and practical. But commercially available (abroad, of course, and with a rather high cost) at that time, the glands did not fit the needs. Some were able to do everything except video, others were only able to video, but did not allow to connect peripherals, etc. etc.
They looked for suitable controllers for sale in Russia - they are available in small quantities and for wild money. With double, and even with triple wrapping. And we need more than one or two pieces, we need a lot of such controllers. A wallet is not rubber. Yes, and indulge the price mayhem of reselling intermediaries somehow did not want to.
We tried to order a debugging board in order to make a device on it that could control the machine and transmit video. But we ran into a problem - foreign stores do not want to send controllers to Russia, since they are on list A — dual-use goods. That is, devices that can be used for civilian and military purposes. At first glance - complete nonsense, but in fact the way it is. All the controllers that arranged us according to the functionality are on that ill-fated list. I personally called Farnell and had a fascinating half-hour conversation with a sweet (hopefully) girl who, with a thousand apologies, said that they could not send us the desired piece of hardware (if I am not mistaken, it was BeagleBoard). It was she who said that in the European Union all the rules are faithfully observed, so they simply cannot send, but in order to send them they need to receive a certificate for the piece of iron, and the certificate is valid for a limited time and is obtained for each customer. The deadline for receiving the certificate is about a month, and it’s not at all a fact that it will be received. In addition, the customer (ie me, in this case) will need a handwritten document certified by a notary, where there will be a full description of the planned use of the piece of iron. I already was going to write such a document, but the girl asked not to strain them in vain, because the probability of getting a positive result is very insignificant, and to have such a ge ... to have such problems because of the piece selling is absolutely unprofitable for them.
After this unsuccessful attempt, we tried to order glands from the states. The piece of iron was called LeopardBoard. She sent us without unnecessary hassle, but problems suddenly surfaced at our, Russian, customs. A piece of paper came from the customs officers in the mail, where they demanded that we prove that the coveted piece of hardware does not have strong cryptography modules on board and something else (I don’t remember exactly what, excuse me). A colleague personally went to the customs, but they could not explain anything worthwhile - the piece of iron lay at the customs for about a month, after which it went back to the sender.
After these ordeals, we finally got angry at the whole world and began to think what to do.
One rainy autumn day, that St. Petersburg colleague came to visit me, sat down in the kitchen with him, and sipping beer, began a heart-to-heart talk about who invented what was interesting to solve our problem with the choice of iron. When it was already drunk quite a lot, a colleague spoke a thought that at first seemed wild. And why, he said, we can’t make our own amusement park, with blackjack and controller whores . Which would initially be sharpened for connecting different peripherals (digital camera, motors, sensors, LEDs, speaker, etc.), would have on board some kind of wireless connection (wi-fi or bluetooth) and would be unpretentious about the power supply. So that you can take a cart (typewriter, tank, plane, copter, then continue to taste), insert a controller into it, add necessary sensors, power everything from any existing battery or battery and as a result get a ready-made smart thing.
The rest of the evening went to a fabulous fantasy on the topic of how many different interesting controlled things can be done by borrowing a suitable controller ...
A list of requirements for the hardware was formulated:
- Low price end device!
- A powerful processor capable of hardware video compression in H264 (i.e., having the appropriate DSP)
- Interface for connecting a digital camera
- USB host for connecting peripherals (3G / 4G modems are especially relevant)
- Low power consumption
- Wide supply voltage range
- Small size (so that you can install in a small machine, for example)
- Linux on board (a large number of already developed software)
- Onboard wireless (Bluetooth was not considered, only Wi-Fi)
- Wired communication (Ethernet)
- PWM hardware generator
- A large number of I / O pins, for connecting various peripherals
- Composite video output (for video transmission using analog video transmitters)
Some time has passed. That wild idea expressed by beer began to be slowly realized. We chose a suitable SoC with DSP on board, which can process and compress video on the fly in h264 with an acceptable delay. Which, moreover, has a bunch of everything in its composition (I / O pins, or GPIO, plus all sorts of interfaces). This is the percentage of Texas Instruments' DaVinci family - TMS320DM365. Digital Media System-on-Chip (DMSoC). www.ti.com/product/tms320dm365 The choice was greatly influenced by the price of the processor, its capabilities, as well as its scope of application - it is very widely used in IP cameras, video recorders, multimedia players, etc. etc.
Then it remains to “only” develop a board based on this processor. At this stage, we are slightly stalled, but soon found a man who agreed to do the development.
At this time (summer 2011), we first heard the mysterious word “Raspberry PI” :-) The first announcement of this piece of iron on Habré was slightly alarmed, because the bourgeois said they were developing a device that was very close to what we were looking for for a long time, and then decided do it yourself. But, having read everything about this Malinka, they calmed down - the piece of iron, though quite close to ours, is not suitable for us in practical application. For RaspberryPi, after all, is more focused on desktop use, although it does have the ability to connect peripherals for DIY applications. In addition, the price, taking into account the delivery, is quite high, given the need to add Wi-Fi, cameras, etc. At about the same time, other similar glands appeared (Beagleboard, Beaglebone, Pandaboard, etc.), but none of the glands fully fit us. This gave us strength, because we finally realized that we were moving in the right direction.
By the way, when I once again called Farnell about the Raspberry Pi, I asked them why BeagleBone is on the list of export restrictions, and Raspberry is not. They didn’t really explain anything to me, but they confirmed that Raspberries are not on this list. Perhaps not yet :-)
The development process was pretty fun. Just the same dream of the poet. You sit, invent what you would like to be on board, and Alexander (a colleague directly involved in the hardware design of the piece of iron) either says “yes, damn it” and adds the functionality just invented to the scheme, or answers that “not very expensively” and offers another option.
All development took place in the time free from the main work (ie in the evenings-nights) and with own money. More precisely, with the money of one of the colleagues, who, to the extent possible, financed the whole project and our entire team. So in all seriousness you can make a sticker “Designed and made in Russia” on a piece of iron. True, from imported parts, there's really nothing you can do. Unfortunately, we did not find the necessary microprocessors and other parts produced in Russia.
So, after a while we had a complete set of documentation for the production of glands. By that time, a name had already been invented. I was driving in a car, listening to the radio, thinking about a piece of iron, about cars, and about how not to bump into a lady on a yellow behe, who very insidiously cut me at the intersection at XXL shopping center. And on the radio "Echo of Moscow" just went on the discussion of another opposition rally and the presenter said the phrase "welcome to reality." And somehow by itself a combination came to mind - virtuality into reality, Wirth into reel, virt2real. He immediately phoned his colleague to Peter, who approved the name and to whom something similar to the mind just came, too. In general, the name stuck immediately. And the piece of iron, accordingly, began to be called "virtualka".
For debugging purposes, it was decided to make ten samples. What was done at one of the Moscow enterprises. In fact, from the first time we made the sample as close as possible to the serial one.
Virt2real Assembled - Two Floors
Virt2real unassembled. A small shawl - for debugging purposes, in the final form a slot for microSD and USB will be on the main board.
Dismantled sandwich, another perspective.
Ground floor chips out
You have no idea (well, with the exception of those people who often develop devices) what it is like to hold in their hands a ready-made board, which was invented a year ago, sitting in the kitchen and drinking beer. This is a thrill, delight and pride in the nth degree. Even if it's just a sample, which already found a couple of jambs.
In general, the process of catching bugs followed. Although, I must say, Alexander did a great job - just a couple of jambs with such a volume of iron is an excellent result. Moreover, the jambs turned out to be eliminated fairly quickly. Unfortunately, there is no video in which it would be captured as a small milling cutter drilled a hole to the third layer of the board (there are 10 layers in total) to swap the lines of the differential pair. It was epic :-)
Gradually, as you tinker with the virtualka, even minor nuances have surfaced that do not affect the quality of operation, but it would be more convenient if they were made a little differently. Such minor corrections were postponed until the next stage - a small series in which all caught defects and inconveniences could be fixed at once.
The most difficult and unpleasant part of the development was waiting for us where it was, to be honest, not really expected. The problem was that none of the team had ever engaged in porting Linux to various hardware platforms. That is, in general, how we do it, we even knew, even the experience of writing our own OS, for its specific tasks, WinCE was ported again, but somehow, fate didn’t reduce Linux to this point. And it turns out there are good Linux builds, if the bad ones ... To revive the board, we used the RidgeRun SDK. This SDK is distributed for a fee, but for non-commercial applications it can be used for free. From software it was required to support the work with the equipment and in general to see what it is capable of. RidgeRun we liked the fact that there is support for a real board on DM365 (Leopard Board), support for hardware codecs is included, and a fairly good file system. But as usual, the devil is in the details (for details, refer to the classic work of freeworld.thc.org/root/phun/unmaintain.html ). It turned out that this SDK, through a myriad of crutches and props, was sharpened specifically for the piece of hardware for which it was originally created - LeopardBoard. Step to the left - step to the right and everything falls apart so that then it is not even going. Moreover, the execution of make clean (attention !!!) leads to the fact that not only traces of the compiler's activity are removed, but the source codes are also reloaded from the RidgeRun repository - goodbye to the changes. Apparently the SDK developers had no idea that someone for some reason might need to edit their code. By a strange confluence of circumstances, it took us 90% of the time to fight the SDK instead of realizing what we wanted. However, in the end, the SDK could not resist the pressure and earned a piece of iron.
In general, the result of the RidgeRun SDK porting work was the decision to develop our own SDK for our platform.
Here at this stage we are now - a piece of iron can be even tomorrow in the series, but with the SDK, not everything is as we would like. That, however, does not affect usability - the virtualka is already fine with trolley and boat (see video at the end of the topic) :-)
In terms of application by the end user-selector, we assume three levels:
1. Beginner - a piece of hardware with our firmware, SSH-access and a web admin. The user can upload his scripts in high-level languages (PHP, Node.js, Perl, Python, Erlang) or ready-made cross-copied executable applications.
2. Advanced - everything is the same as for a beginner plus an SDK for building your own and any third-party applications.
3. Profi - uses third-party distributions and SDK (Arago / OE / Angstrom / other)
Now available on board are high-level programming languages from the usual gentlemen’s set - PHP, Node.js, Perl, Python, Erlang. About Bash generally keep quiet. This kit is enough to meet 80% of the needs in terms of driving things management. For the remaining 20%, C / C ++, but cross-compilation is required.
Almost all the functionality of the controller is available from the "admin" - samopisny control web interface. Convenient - no need to climb into the console.
The prologue is over, now the most interesting is the description of the board.
The virt2real device, the Virtuylka, is based on a Texas Instruments DaVinci TMS320DM365 processor. It is possible to install a more powerful modification, TMS320DM368 (400Mhz), they are fully compatible on the legs.
Since it was originally planned to use controlled hardware on board, they did not mount a digital video output on the board, although the percentage allows it (HDMI). Perhaps add to the specialized version of the board. But on board there is an analog video output, i.e. it is possible to transmit video using an analog video transmitter, which is quite important when operating over long distances.
The circuit board (actually, the controller itself)
The device is a two-story.
The first floor is the main board on which all the main modules are mounted. The board has ten layers.
Second floor - expansion card. Developed separately for each specific application, in the case of serial production of a particular product. At the moment, the second floor is common for DIY use. Signals GPIO, RG45 are displayed on it. Power chips were mounted and terminal blocks for connecting the power load - motors, light bulbs, etc. were divorced from them.
Real Time Clock PRTCSS (Power Management and Real Time Clock Subsystem)
Four 64-bit general-purpose timers
One 64-bit Watch Dog timer
The processor is made on 65nm technology
Extended temperature range (-40 ° C - 85 ° C) (for the version of the processor in the industrial version), for the usual -
DSP
MJCP and HDVICP hardware acceleration
Hardware support for H.264, MPEG4, MPEG2, MJPEG, JPEG, WMV9 / VC1
The resolution of the encoded video is D1 or less, 720p (1080p for DM368) 30 fps
Video subsystem
4: 2: 2 (8- / 16-bit) interface
8- / 16-bit YCC up to 24-bit RGB888 digital output
Hardware On-Screen Display (OSD)
IPIPE Interface (IPIPEIF)
ISIF (Image Sensor Interface) and CMOS Imager Interface
Histogram Module
Lens distortion correction module (LDC)
Hardware 3A statistics collection module (H3A)
Composite NTSC / PAL video output
Component video output (the corresponding signals are displayed on the second floor, but final support is to be implemented)
LCD (supported by the processor, but not used in the current version of the board. It will be used in the next versions)
Memory
DDR2 128 - 256Mb
NAND 256Mb
Interfaces and Peripherals
GPIO - 51 pcs. Logic levels 3.3V and 1.8V
PWM - 4 pcs
I2C
SPI - 5 pcs
UART - 2 pcs
DAC - 3 pcs
ADC - 6 pcs
USB 2.0 High-Speed host port
USB client
microSD
Analog component video output
Analog composite video output (maximum 480p)
Audio Codec CQ93VC (AAC-LC, G.711, MP3, WMA)
Audio Line Out (mono)
Audio output per speaker (mono, 300 mV at 8 ohm load)
Analog microphone audio input
10 / 100Mb RJ45 Ethernet
Digital camera input
Wi-Fi b / g (HDG104 chip)
Connectors for connecting the power load (motors) (3 chips L293D)
McBSP Interface (Multi-Channel Buffered Serial Port)
Camera
OV7690, OV7675 (8-bit bus) have been tested at the moment, any should work with the 8/10-bit bus, if the corresponding camera driver is available
Nutrition
2.8 - 15 Volts. Current consumption (main board with wi-fi on) at a voltage> 5V - 220mAh. When the supply voltage is less than 5V, the current consumption is greater. SEPIC, , , 3- 5 USB.