📜 ⬆️ ⬇️

Nokia N900 + Q-steer = Fun

Wandering once around the Runetovsky expanses, I stumbled upon the banal Yandex.direct block once. But something interested me there, and I got to a certain site. Where traded controlled cars. It seems to be nothing special, but in the end it led to quite interesting things and to this topic.

These machines are called Takara-Tomy Q-Steer (also known in the United States as Microsizers and ZipZap). The radical difference between Q-steer machines (namely, they traded on that site) is that they are small. Very small. Very very. Length 4 cm, width 2.7 cm, to be exact. But, despite this, the cars are completely manageable. Understand the command back and forth, left and right. And there is a boost (!) And another interesting point - the control channel - IR. Infrared radiation. They have a kind of machine (a little bigger in size, but not much) on the radio control, but they are not suitable for my needs.

In general, after spending a few hours on that site and having studied almost everything there, I decided to buy a typewriter. With control through IR, of course, for one interesting little thought appeared.
')
In Moscow, these machines could not be found, so I ordered on the found site. The delivery took several days, but on the very first day after the order I was fired from my current job, so that in the running the remaining time before the parcel arrived flew very quickly. I will not tell about unboxing - I ripped off the wrapper, tore off the plastic, took out the machine and the remote. It's simple.



At the first personal contact with the machine, I experienced a small shock - “so small, will it really go?”. True, they could not go right away - there were no batteries in the kit. And the batteries there to match the typewriter - also small, "watch" LR44. Only after some time, after reading the instructions and finding out that the machine should be turned on by turning the inconspicuous lever, it turned out that there are batteries in the console and in the machine. So you can drive.

Well, I drove :-) The first experience of micro-shooting was captured on the large video.



In general, the machine is ideal for the office - you can perfectly drive around the table, the chairs, the laptop ... In short, you can drive even along the rim of the toilet bowl.



But manual control of the machine is trite and uninteresting. I want control from something aytishnogo (I do not like this word, but still have to get used). I already managed to find out that for the Sony PSP there is a software for controlling Q-steer typewriters . However, it works only on older PSP models with IR. I have the same PSP Slim, but there is no infrared port on board :-(

Of the gadgets with infrared at hand, I now have only the Nokia N900. True, the IR port is a bit neutered - it can only transmit signals, but not receive. But to control the machine to take something is not necessary, so that the N900 is suitable. There were no ready-made programs for the N900 that could control my typewriter, so I had to do it myself.

The whole process of writing a softphone consisted of the steps:




As a result, these stages were delayed for two days (or rather, for two nights). The first was devoted to attempts to decode the IR signals from the console. I have been using a home-made IR receiver for WinLIRC on the desktop for a long time, but it came up perfectly to receive signals from the console. But a problem popped up - WinLIRC did not want to learn the commands of the console. I tried all the settings options - it did not help. And the RAW codes also did not want to be recorded, so I had to manually rip them out of the test window for receiving RAW signals.

A little bit of ice, but managed to catch all the necessary codes for the main types of movement. But I didn’t use the afterburner button. Mixing all the codes into one configuration file led to the appearance of the following : a settings file for the Q-steer console . True, all the settings are only for the B range, I have not climbed into the A range yet, I have only one machine :-)

In general, this was the first part of the subject after equality - “Fuck first”. For fucked with codes really. And yet to have sex - while a little twitchy control turned out, we must pick further.

There were no problems with playing the received signals on the N900. For on this mobile tablet, the usual lirc stands quite for itself, for which the Q-steer remote control settings file that I formed was very suitable. It remains only to slip his lyrese.

In the file /etc/lircd.conf we add the includ of our file with the config (in my case it is located in / home / user / MyDocs / DISTR / Q-STEER / qsteer)

include "/ home / user / MyDocs / DISTR / Q-STEER / qsteer"

Restart lyrts. Of course, it should be done under the root.

sudo gainroot
/etc/init.d/lirc restart

So, the infrared control daemon is running, it remains to send commands to it. And in general, how will we manage?

And we will manage the tilt of the phone. In vain is there an accelerometer in it? We tilt the phone strongly forward - the machine goes forward. We lean slightly forward - going backwards. We lean slightly back - the machine stops. Almost the same with turns. Tilt to the left - the machine to the left, tilt to the right - the machine to the same. Why it was not to make the movement of the machine back with the same tilt of the phone - just the signal of the infrared transmitter of the phone is weaker than that of the native console, so it’s better that the IR LED is directed towards the machine, and this happens only when the phone tilts forward. By the way, looking ahead - if you put the phone vertically - this is the exit from the program.

The basis for obtaining the coordinates of the rotation of the phone took a fairly well-known script shake.py by Niklas Tanskanen. For a sample interaction with lirc, a script from a Blubbi from the Maemo forum . I have never come across Python before, and here is a good reason to try out in this language. By the way, gut as unusual after C / C ++, PHP, JavaScript, etc. IMHO, especially if the conditions IF look wild :-) Yes, I am asked Python.

In short, what is the result? And that's what happened.

The qsteer.py script is controlling the Q-steer from the Nokia N900 tablet by bullying the accelerometer.

It looks like this. It is difficult to control both one and the camera at the same time. And with the management I have not fully mastered.


The movement is still twitchy, it is necessary to correct the control signals. And to eliminate small jambs (the sending of pulses is sometimes repeated when they are already being sent, because of this, at the end of the video, an error message is seen). But in general - everything works !!!

It remains to do the training route - so that you can specify the commands and the phone itself in a cycle of their typewriter fed. But these are details, it will not make up the work.

Nid HELP!
Managing RAW codes sucks. For jerking rides. Need to emulate normal control signals. Who can prompt how to learn parameters of the protocol of management for LIRC? WinLIRC refuses to learn, apparently non-standard sequences of pulses.

UPD> Yes, by the way. Do not think for advertising, the store is called mikrogonki.ru . If suddenly you are going to order a typewriter there - in the field “Notes to the order” write “I am from a bald one”. Suddenly, you see, they will give me a typewriter :-)

UPD> Found where my cant! Under beer, I think better, right now, the machine is already moving backwards without jerking, it was just necessary to throw out the start bit. Now I will correct the rest of the codes and lay out a new prufvideo.

UPD> Corrected codes, now moves without jerking. Although occasionally, all the same, slows down. But this is due to the fact that the N900 is not very powerful IR transmitter and quite directional. File with setting LIRC perezalil.

Here is a new video that demonstrates movement with fixed control signals.



UPD> Q-steer, it turns out, out of production. They came to replace the typewriter Choro-Q. A small autopsy arranged here . Also controlled by IR, but the codes are different, right now, I understand.

Source: https://habr.com/ru/post/109850/


All Articles