Saturday, February 8, 2014



I have worked on some new features for my CarPC. Here are the changes:
First, some videos:

The latest image can be downloaded from the Downloads link on the right of this blog(username:pi, password:a).
If you do not have any rotary encoder connected or any buttons with a resistor you need to disable the carpc-controller application. You can do this by editing the file /home/pi/StartCarPC and commenting the line which contains carpc-controller.

Hardware updates:
- added ViewHd HDMI to HDMI+audio board
- added SI4703 FM Radio module
- created an expansion board with fm radio module and three connectors(one for GPS receiver and two for rotary encoders)
- added a very cheap board to mix two output channels(RPI and radio) into a single output(which goes to the amplifier, in my case AUX input of the car player)

Software updates:
- added loading movie(created by Doru Ignat)
- added a python server responsible for controlling the radio module via i2c
- added new XBMC plugin for controlling the FM Radio(including storing up to 5 radio stations in a file)
- improved carpc-controller to support sending multiple commands for a single button press or encoder turn(e.g. turning right one rotary encoder can increase the volume in XBMC and the volume of radio at the same time)
- improved the speed in Navit clicking
- improved the Navit OSD for both day and night setup(Navit switches automatically teh setup based on the time of the system).
- added time synchronization mechanism based on GPS readings(RPI does not have a real time clock)

The expansion board.

RE1 and RE2 are rotary encoders.

The FM Radio driver and Python server.
The FM Radio module is connected using i2c communication interface(GPIO0-SDA and GPIO1-SCL of the PI).
The radio driver is contained in the si4703 python class. The Radio server is implemented in the file is automatically started at boot time). This server simply opens a socket and waits for data. After any data is received, a couple of if-else statements different radio functions are called base on the incoming data.
The available commands are:
seek_right - search for a new station in the right of the current frequency
seek_left - search for a new station in the left of the current frequency
tune_xx.x - set the current frequency to xx.x MHz
volume_xx - set the volume of the radio module to xx. xx should be between 0 and 15
toggle_mute - toggle mute
get_frequency - get the current frequency
The server reply with the current frequency for each command.

Simple test.
To understand how this radio server-client works you can make the folowing experiment:
1. Plug the gpio expansion board(or wire the radio module to the PI as in the above schematic)
2. [Server] Connect using one ssh window(I use Putty) to the PI and enter the folowing commands:
cd radio
sudo python
The radio server should initialize the  radio module and start the server.
3. [Client] go to the radio folder and use to send commands o the radio server, like in the folowing picture:
The file simply opens an UDP socket, puts an '_' character between arguments and send the obtained string to the server socket.

The radioFM XBMC plugin.
In order to simplify user interaction I have created a new XBMC plugin(radioFM). Its purpose is to allow interacting with the Radio Server(and with the Radio Module) using the touch screen. In order to be able to use this plugin you need to have the started and the FM module plugged in.
  • The current frequency is displayed at the top.
  • The left and right arrow buttons are for seeking to the next channel(left or right).
  • The bottom 5 buttons are preset channels(these are kept in a file so they are available after reboot).
  • The Set/Tune Channels button is used for changing the mode in which the bottom buttons are operating. By default they are in the 'Tune' mode, so if you presss them the radio will tune to that frequency. If you press the Set/Tune Channels button once you will enter the Set mode, which will allow you to store the current channel in which preset button you like(or in all of them... if you want) by pressing it once. You will see that the frequency will be changed.
Connecting two audio sources(RPI and Radio) to one amplifier.
In order to correctly hook up two audio sources together(putting them in parallel) for a single output you have to use one schematic from this document. I have used the last schematic. Don't forget to use at least 1% tolerance for the resistors.

The new GPIO controller.
The GPIO controller is now using the official XBMC client code from xbmcclient.h.
Now, you can call a lot more XBMC functions for any button pressed or encoder movement.

TODO List:
- update to the latest Raspberry PI firmware(today it is possible but then Navit won't be visible)
- remove the calibration file for XBMC(/usr/share/eGalax/touchscreen_axes_calib) and use the values from the Debian calibration file(/usr/share/X11/xorg.conf.d/01-input.conf)
- create an XBMC addon to allow calibrating the touch screen for both XBMC and X11 windows and also for calibrating the external encoders and button
- create a configuration page(XBMC addon) for the carpc-controller settings
- create a better audio mixer unit
- create a new page for launching different X11 applications


  1. Hi.

    I can use your image file to install on cubieboard2

    Thank you.

  2. You are Nº1 !! Thankz for sharing

    1. Hi master,
      My video don’t go to full screen i can see the small rpi logo in top left and when loads the desktop the task bar. Because i don’t have your gpio remote i have to disable it (windows open and closing without doing nothing) and x11 cursor its not visible in xbmc.
      Many thanks for sharing you hard work.

    2. (windows open and closing without doing nothing) , I have the same issue, how can I solve it? How or where dissable gpio remote?

      Thanks a lot

    3. Hi!

      If you don't have any gpio connections you have to stop the carpc-controller from starting. I have updated the post with a note. Please have a look!

    4. Hi master,

      I have a touch calib problem when going from home screen to navit e think its because the X11 dont take control of touch calib (runing navit from X11 works great), any idea?
      Im trying to install the hello world script but no success one time more any idea?
      I want to put my modest program working with yours dont now if is better to do with the "script-way" or the navit (i tried changing the navit to my sec but no image) can you please tech me?
      You are top

  3. Hi thanks very much, yes it works!!

  4. Thanks a lot Andrei, your work is very impressive!
    I still have two questions.
    Do you have your car antenna connected to the SI4703 module and which values have your resistors R1 and R2?

    1. I have connected the car antenna main wire to the ground of the jack on the SI470 board, as this is the FMIP pin. See here how the chip is connected:
      The signal of the fm antenna can be improved by matching the impedance of the car's antenna, which probably is 50 ohm with the impedance of the si470 breakout board. This is a very complex operation and i have to study more, but if you have any more experience in rf domain please let me know of any improvements.
      R1 and R2 have 1Kohm value, but actually you can use any resistors, as long as they don't get too much current.

    2. I dont get how that works, i have an Si4730 breakout board I connected the centre of the car antenna to the FMIP and i cant pick up anything. Infact I'm surprised it even does with yours as you need an inductor and a capacitor match to the impedance on both sides. L1/C1 ive tried so many times and had no results at all.

    3. I have the breakout board from Soliddigi and an RF amplifier and I have all fm stations in my area. I don't have the same stations as a car fm receiver when I am far away from cities. I am agree that this setup needs an impedance matching, but didn't had time for investigating this and I am not an RF expert. If you find any good matching please let me know.

    4. The breakout by sparkfun for the Si4703 is just about impossible to get working with a car antenna. The antenna needs to hover inbetween the min FM frequency and the max. Its difficult to get it to do that. I have tried and tried for 2 weeks and ive given up with it. I tried a TEA5767 and had the same issue. The problem with car antennas is that most of them are a high gain whip type that aren't suitable for use with that chip. I did try an Si4705 but i had the same results with that. The biggest problem is that no offers the whole range of silabs chips in small quantities so getting the right one for the purpose is near impossible. Once you connect either of these chips to coax you've lost the signal. The breakout i was using has a 75ohm impedance and so does the car antenna. It didn't work no matter what. I am looking into other viable option before spending out on a digital tuner built for purpose.

  5. This is so great! I'll try to build something like this for my own car.
    How do you deal with powering off the car? Do you have to remember to power off the RPi before it loses electricity? Or have you found a way to deal with this?
    Also, would you mind explaining in a word or two how you connect the hardware to the car battery?

    Thanks, greetings!

    1. In my setup i have the shutdown button in the home screen, but you can search on the internet, there are couple of automatic on/off switches.

  6. Great progress, I've been following your blog for a while.

    For audio mixing, check out the TLV320 codec chips like
    That chip has both analog and I2S input, so you could directly use the rpis I2S output.
    THe only downside might be designing a board for it.

    Do you have plans for displaying RDS information from the FM chip?

  7. Hi Andrei,

    respect for this cool project. Exactly what I wanted to setup for my car.
    With your latest build I'm able to use the new PI USV ( which needs i2c drivers.
    Everything seems to work correctly now except the calibration of the touch screen
    ( which is not exactly yours, but also eGalax )
    The Y-Axis works correct, but the X-Axis is mirrored. I tried to follow your explanation about the calibration, but no changes in /usr/share/eGalax..../touchscreen_axis_calib seem to have an effect to the touchfield behavior.

    Is there another file where I have to change settings?

    Here are my parameters: xinput : Option "Calibration" "84 1990 1863 106"

    and /usr/share/eGalaxCalibration/touchscreen_axes_calib: calib_x_d=1280;calib_x_fact=-0.660474716;calib_y_d=720;calib_y_fact=0.41025641;swap_axes=1;click_confines=8

    maybe you'll find the error?


    1. Hi,
      I see that you are are setting calib_y_d to 720 and calib_y_fact positive. This means that the y pointer will be moved down with 720 pixels.
      From the way you set calib_x_d and calib_x_fact the x axis is mirrored. If you want to disable the mirroring you have to set it like:
      You can see if the values are loaded properly by starting xbmc by hand over ssh with /usr/local/lib/xbmc/xbmc.bin


  8. Hi Andrei, I downloaded your latest image (Feb 16 2014) and wrote to the sd card - but raspberry is not booting up at all. I tried downloading and writing the image using win32diskimager a couple of times - but no luck.

    Am I missing anything?

    1. Hello,
      I think you have the newer raspberry pi and it is a problem with the firmware i use.
      I will soon release a new image with latest firmware which should work on all RPIs

  9. Hi Andrei,

    I've searched a lot and built my own concept to create an car pc, but then I saw your project and
    So I'm looking forward to use your project in my car
    What is the best practise to do this? Just buy exactly the same things as you did, download your images and put the rPI in my car?
    Thanks for your project!

    1. Hi,
      The best way is to buy similar hardware to avoid issues. The hardware i use is the cheapest found on market.

  10. Any updates Andrei? You've gone quiet. :)

    1. Please see my latest post:

  11. Andrei; I'm using your most recent downloads. The XBMC loads up and runs. The mouse (generic Microsoft) moves around the screen, but no button clicks work. I am able to highlight objects and using the ENTER key, activate them. I do not have this problem with any other Raspian builds (the mouse works fine....)

    Also, when I exit the XBMC, the screen goes totally blank. I am unable to do anything.

    How can I either exit XBMC and get to an LX terminal, or how do I boot and prevent XBMC from loading in the first place?


  12. Hello Andrei,
    I wanted to ask whether it is possible to get this touchscreen calibration addon?! I'm using my selfcompiled version of XBMC with your patches - only missing thing is your addon. Where can I get this? Have you updated your touchscreen patch? Can I get the newest one and the addon? Or where can I find it?

    Thank you very much for your work! Where can I donate?

    1. This comment has been removed by the author.

    2. Hi,

      You can get my latest patches for XBMC Gotham and Navit also from my Downloads page in the top right corner of this blog. If you wat to donate you can use my paypal address on the top right of this blog also.
      Thank you!

  13. Okay just found the patches and now I've a working build! I've installed the CarPC Skin and it works but I can't see the calibration addin... btw I'm using OpenElec...! Please help me...

    1. Hi,

      I have uploaded the calibration plugin, but you also have a look at the patches because there are some functions needed(xbmcgui.getRawMousePosition).

  14. Hi Andrei,

    Sorry to trouble you (again). I have SI4703 FM module connected exactly as you have. My pi has loaded into XBMC but I have connected by SSH and followed your instructions. I get this ...

    pi@raspberrypi ~ $ cd radio
    pi@raspberrypi ~/radio $ sudo python
    Starting Radio Module...
    /home/pi/radio/ RuntimeWarning: This channel is already in use, continuing anyway. Use GPIO.setwarnings(False) to disable warnings.
    GPIO.setup(0 ,GPIO.OUT) ## SDA
    Exception in method 'update_registry' while trying to read from si4703
    Traceback (most recent call last):
    File "", line 6, in
    File "/home/pi/radio/", line 34, in init
    File "/home/pi/radio/", line 160, in update_registry
    reordered_registry = si4703.convert_reg_readings(self, raw_data, 1)
    File "/home/pi/radio/", line 97, in convert_reg_readings
    first_byte = str(bin(old_registry[i]))
    IndexError: list index out of range

    Is this because it is already loaded and running in xbmc? This radio stuff is all new to me :)

    Any help is appreciated. Cheers mate.


    1. Hi Chris, I am getting exactly the same problem with the FM radio. How did you manage to resolve it?

    2. Hi,

      I have added an update for the radio files. Please get it from
      Just unpack it and then run script.

    3. Thanks Chris, everything worked like wonders. Thanks Andrei too!

    4. Hello

      sorry my english is not so good because i´m from Germany :-)

      i have a problem i instlled all everthing is doing but the radio not

      here the error:pi@raspberrypi ~/radio $ sudo python
      Starting Radio Module...
      /home/pi/radio/ RuntimeWarning: This channel is already in use, continuing anyway. Use GPIO.setwarnings(False) to disable warnings.
      GPIO.setup(4 ,GPIO.OUT) ## RST
      /home/pi/radio/ RuntimeWarning: This channel is already in use, continuing anyway. Use GPIO.setwarnings(False) to disable warnings.
      GPIO.setup(0 ,GPIO.OUT) ## SDA
      read reg #7: 0x100
      read reg #7: 0x8100
      read reg #7: 0x8100
      set AHIZEN
      +updating AHIZEN
      read reg #7: 0xbc04
      read reg #7: 0xbc04
      read reg #7: 0x8100
      read reg #7: 0xbc04
      read reg #7: 0xbc04
      read reg #7: 0xbc04
      read reg #7: 0xbc04
      read reg #7: 0xbc04
      read reg #7: 0xbc04
      Radio Module successfully initialized
      Traceback (most recent call last):
      File "", line 13, in
      sock.bind((UDP_IP, UDP_PORT))
      File "/usr/lib/python2.7/", line 224, in meth
      return getattr(self._sock,name)(*args)
      socket.error: [Errno 99] Cannot assign requested address

      can you help me?

      linux is new for me please tell about a noobie :-)


    5. Hi,
      Please use my latest update and also use the forum to solve issues.

    6. hello

      the last update is on the raspberry .. but i try it again and will report


  15. Realy nice but i hav a problem with calibration. I have a 7 inch touch ut if i want to calibrate the button for bottoms are out of frame so i dont can calibrate my touch. but why

    sory for my bad english :-D

  16. Hi Andrei, I've installed the img, and everything is working except the X axis its mirrored (right to left). I think that maybe i've put the touch panel on the opposite side to the display. Must I take apart everything, and start from the beginnig or could be corrected by changing something in the kernel?

  17. And also the sound comming from my Rpi B+ is with interferences. Everytime the green lamp blinks new interferences are coming. What could be wrong with it. I'm using 3.5mm stereo music jack (not the A/V jack that kind is the output).

  18. Hi Andrei,
    I'm trying to get the old modul. But I can not find any version of your software older than 1-Oct-2014.
    Were can I get it, pls?

  19. Hello Andrei, what you have done is absolutely fantastic, i have ordered the hardware for this project, i hope it goes smooth.

    ( wishes & blessings from India )

  20. This comment has been removed by the author.

  21. Hello, a question, does this application allow a USB external harddrive to play movies or allow devices like an IPAD or phones to access a external drive connected to it VIA wifi or bluetooth

  22. Sorry one other question can I use this application like a BLuetooth connection for my phone so i can pair it to use it hands free.

  23. Since you have summed the outputs from the fm radio and the raspberry pi, what causes the radio to stop its output when you are using another function generating sound from raspberry pi? If GPS is being utilized would you receive voice over directions while listening to the radio?

  24. I appreciate your efforts and i always like to learn more and more ... thanks a lot for nice efforts
    fire courses
    safety courses

  25. as many as i visit this blog i can find some fantastic information . Thanks for sharing knowledge . best wishes to be guided
    free ads
    advertise for free

  26. Thanks for sharing !
    When it comes to Health, Safety and Environment solutions, Poshe Solutions Pvt. Ltd is the leading institute for all international safety courses.
    Nebosh course in chennai
    Nebosh courses in chennai
    Nebosh in Chennai
    Nebosh IGC in Chennai
    Iosh Ms in Chennai
    Iosh courses in Chennai