DEV Community

Cover image for How to generate radio code for Fiat 500 VP1/VP2
Bartosz Wójcik
Bartosz Wójcik

Posted on • Updated on

How to generate radio code for Fiat 500 VP1/VP2

If you ever disconnect a car battery, you might end up with a locked-up radio player. This is a standard anti-theft protection.

To unlock the radio again, you will need to generate a radio unlock code. I will show you how to generate it from Python using the Radio Code Calculator library.

Step 1: Install Radio Code Calculator API

The library is available on GitHub with full sources

https://github.com/PELock/Radio-Code-Calculator-Python

and on the PyPI repository.

https://pypi.org/project/radio-code-calculator/

To install it, simply add it to your new Python project with a command line of:

pip install radio-code-calculator

Step 2: Read your Fiat 500 radio serial number

The serial number is located on the placard on the back of the radio box. You will have to dismount it, but it's pretty easy:

You will need the last four digits of the serial number

Continetal Fiat 500 Serial Number Placard

Step 3: Generate the radio unlock key

Once you obtain your API key from the Radio Code Calculator service, you can check up the Radio Code Calculator SDK documentation for all the parameters to generate the code for the right radio model.

#!/usr/bin/env python

###############################################################################
#
# Radio Code Calculator API - WebApi interface usage example
#
# In this example, we will demonstrate how to generate a code for a specific
# type of car radio.
#
# Version        : v1.1.5
# Language       : Python
# Author         : Bartosz Wójcik
# Project        : https://www.pelock.com/products/radio-code-calculator
# Homepage       : https://www.pelock.com
#
###############################################################################

#
# include Radio Code Calculator API module
#
from radio_code_calculator import *

#
# create Radio Code Calculator API class instance (we are using our activation key)
#
myRadioCodeCalculator = RadioCodeCalculator("ABCD-ABCD-ABCD-ABCD")

#
# generate radio code (using Web API)
#
error, result = myRadioCodeCalculator.calc(RadioModels.FIAT_VP, "5849")

if error == RadioErrors.SUCCESS:
    print(f'Radio code is {result["code"]}')
elif error == RadioErrors.INVALID_RADIO_MODEL:
    print("Invalid radio model (not supported)")
elif error == RadioErrors.INVALID_SERIAL_LENGTH:
    print(f'Invalid serial number length (expected {result["serialMaxLen"]} characters)')
elif error == RadioErrors.INVALID_SERIAL_PATTERN:
    print(f'Invalid serial number regular expression pattern (expected {result["serialRegexPattern"]["python"]} regex pattern)')
elif error == RadioErrors.INVALID_SERIAL_NOT_SUPPORTED:
    print("This serial number is not supported")
elif error == RadioErrors.INVALID_EXTRA_LENGTH:
    print(f'Invalid extra data length (expected {result["extraMaxLen"]} characters)')
elif error == RadioErrors.INVALID_EXTRA_PATTERN:
    print(f'Invalid extra data regular expression pattern (expected {result["extraRegexPattern"]["python"]} regex pattern)')
elif error == RadioErrors.INVALID_INPUT:
    print("Invalid input data")
elif error == RadioErrors.INVALID_COMMAND:
    print("Invalid command sent to the Web API interface")
elif error == RadioErrors.INVALID_LICENSE:
    print("Invalid license key")
elif error == RadioErrors.ERROR_CONNECTION:
    print("Something unexpected happen while trying to login to the service.")
else:
    print(f'Unknown error {error}')
Enter fullscreen mode Exit fullscreen mode

Step 4: Run the script

For our sample serial number ending with 5849 the radio unlock code for Fiat 500 is:

Radio code is 5621

What can you do with it?

  • Sell the radio codes on eBay or Craigslist

Fin

It's pretty simple, and this is just for Python. The library supports JS and PHP, too, so you can integrate it within your sites, apps, and scripts pretty easily. It also comes with a simple online interface to generate the codes for non-programmers.

Top comments (0)