Sunday, 7 May 2017

Communicate between Raspberry Pi and Arduino

I was looking how I could talk between Raspberry Pi and Arduino, because sometimes is much easier to get a sensor, driver motor or else ready in C instead of trying to code something that will take months to get it working.

Raspberry Pi has the advantage to have SPI, I2C and Serial port communication, but for laziness I chose the Serial port. Of course you could try to go for SPI or I2C but it will take a little bit of more time to setup everything.

What you need:
You can use the serial port already existing on the Raspberry's pins but to make sure that I am not going to send some dirty data, because you can access the console via com, I chose to buy a usb ftdi.
You can buy the "official" usb to ttl, that will cost you around 15 pounds or you can go for a standard and cheap one here that works great!

Connect the usb ttl on your Raspberry's usb port and then 3 cables in yours Arduino, remember to dont connect the power pin! It wont damage your Arduino but better dont risk.

 Black pin = > Arduino Ground
 Green pin => Arduino RX
 White pin => Arduino TX

You can choose other two pins for RX and TX but if you need to talk straight to the Arduino, just use the common serial port.

I did few lines of code in Python, or just use any other languages to read and send on serial port.
This is the simple code:

On your Arduino just write whatever to answer or decode from Raspberry Pi, this is a simple example:

It's pretty simple and easy to communicate via Serial port, make sure that you always:

  • select right bitrate
  • remove the usb ttl when uploading a new Arduino project
  • try simple communication if there is any communication problems
  • never connect the red pin to the Arduino board

Saturday, 15 October 2016

Huawei E3131 issues with 3G

I had some issues with my dongle due to a change of carrier and probably change of frequency.
My lovely dongle stopped working on 3G network and decided to connect only on 2G, which made my life a hell.

After few head scratches ( 4 hours ), I tried to upgrade the firmware, which was very hard to find due to the old hardware and only few people providing the software.

I found this russian website which has a good archive of firmware, just use google translate to read what the website say.

The procedure is easy:
1) Connect your dongle to a windows machine
2) Run the upgrade firmware software and it will make the device become a serial port
3) If you dont have the driver installed, you will need to download the Mobile Partner software which includes all drivers
4) If you run windows 10, make sure you reboot on "disable signature drivers" or you will never install them
5) You might need to edit the ini to allow the driver to be installed as not all of the devices are listed but the driver is generic
6) After all of this, run again the upgrade firmware software
7) At some point you will be asked to insert a password, go on here and use your IMEI to get your password
8) After all of this, the job is done! I got back my 3G connection.

Small tip, you will probably need to flash WebUI as well, on my case, it just didnt work and I had to flash it.

I hope this helped someone else.


Saturday, 13 February 2016

Karcher SC3 Broken

A very interesting Saturday where I had this Karcher Steamer machine which turned on, detecting water level but not able to warm it up.

After a bit of thinking I have decided to open it and try to find the issue on this simple system, maybe a fuse? Maybe a broken part? It must had be very simple!

I had to follow each cable and understand how it worked:

The controller is powered up and checking if the water is present, if not a light turns on and the pump doesnt turn on.

When the water is present, a pressure detection of 2.1 Bar is taking care to turn on and off the heating element.

When then temperature goes low, the switch turns on the pump that allows the water to be pumped inside the heating system.

Luckily my issue was very simple, I have tested the pump and few connections but nothing was broken or burnt. What I didnt actually check is the long run cable where a female connector wasnt secure inside the pin which controlled the whole heating and pump system. 

Put all back together and I had my steamer machine working without buying a new one or contacting the support.

Product on amazon:

Tuesday, 3 November 2015

Talking Scary Pumpkin


It is Halloween, or at least it was when I made this pumpkin,  and I had to make something scary otherwise.
The pumpkin needed to have sound, flashing lights and sensor to trigger when people were walking past, and everything powered with 9V.

Code is available here


I ordered a simple MP3 serial player to connect to the Arduino, one small amplifier to pump the sound, two speakers, PIR sensor and a lot of leds.

MP3 Serial player
PIR sensor

But remember, dont buy always cheap stuff otherwise you will end up to fine tune your installation without any clue, read more about below.

Why you need to spend that pound more
I tried to make the whole project as cheap as possible due to the pieces that I wasnt going to re-use anymore. But this came with a price to pay, having sensor which dont have any labels on the PCB and you have no clue what each pin do and how to tune it.

After few investigation and comparing the good PIR sensor to this cheap one, I find out what are the pins to connect and the two potentiometers.

From the picture above you can see no labels are on the board and I pointed each one pin where should be connected to get it working.

The potentiometers was a bit tricky as different boards on the internet were showing different functionality. 
This board has the first potentiometer which set the sensitivity of the sensor, turning to the left it will make less sensible and to the right more sensible.
The second is setting the timing but it is very sensible as the position on the picture would be 65 seconds of wait and twisted all the way to the left is 2 seconds, so I would assume that all the way to the right might be 260 seconds. 

I hope these information might help someone having the same issue as I had in this installation.

You can see from the picture below that is a total mess! Sorry, I didnt have time to clean it up as it was a one day project and it needed to work the day after.

I have used some stick to help to position some leds in the eyes, position the PIR in the nose, place the speakers on the back, some leds inside to make a nice light reflection and the arduino.

The MP3 player was connected over Serial and then amplifier on the output and then to the speakers, make sure you use 5V, otherwise the module might reset and make a horrible noise.

I had 4 strip of leds which had 4 light on each one, I have connected them to 4 pwm pins to make sure I can play with flashing and fading.

I found an old case for the battery which will provide 9V to the arduino and the PIR sensor connected to one of the digital pins.

How it works
Probably you already understood what I have done if you read the lines above, but my idea was to scary people by walking pass to a glowing pumpkin and make them think that it was alive.

The Arduino has two modes, one that glow all the lights with a different timing, and one flashing and triggering the sound. The PIR sensor was the device that was triggering the different mode and some delay to make sure the pumpkin wouldnt go crazy.


A video posted by Christian Bianchini (@christian.bianchini) on

A video posted by Christian Bianchini (@christian.bianchini) on

Saturday, 24 October 2015

MP3 Player Serial

The mp3 player serial is a cheap solution to add sound to your project, otherwise you could get a shield from Sparkfun or Adafruit which would cost more.

Shop online

I couldn't find much information about this device or the vendor didn't give me a datasheet or sample arduino, so after I google for a while, I found all of it.

Datasheet and Sample Arduino


The wiring is pretty simple, connect the serial communication to the Arduino and 5V is required.
In my project I add a 3W amplifier just in case the sound wouldn't be too loud but otherwise you can avoid it.


The datasheet confirm that there are these commands available for this module:

  • Next song
  • Previous song
  • Play with index
  • Volume up
  • Volume down
  • Set volume
  • Single cycle play
  • Select device
  • Sleep mode
  • Wake up
  • Reset
  • Play
  • Pause
  • Play with folder and file name
  • Stop play
  • Cycle play with folder name
  • Set single cycle play
  • Set DAC
  • Play with volume

Tuesday, 5 May 2015

3D Printed Chain Guard

I changed my Crank of my bike recently and it didn't have a chain guard to protect my jeans to get smashed and dirty.
The options were to buy one online that means 10-12 GBP or to get a 3D model online and print it with my "already paid" filament.
I went on Google and found one model that looked good and big enough for main Crank but when I tried on my bike, it was too small.  What I have done is to measure the right diameter and increase the size to match my 12 cm disk.


I have shared the model, even if it is not the correct ratio, but people could improve it and print it.


Final result with 4 M4 screws

Friday, 13 February 2015

Leds Jacket

In my little part of Switzerland, there is a huge celebration for the carnival that can last for over a month, and one of the way to enjoy this event is to dress up, party and enjoy the night.
My project fits into the "dress up" step, where I made my own costume leds jacket that react with the sound and has different modes.

- 1x old jacket
- 1x arduino
- 1x spectrum sparkfun or MSGEQ7
- 1x microphone
- 1x Lipo battery
- 1x 9v battery
- 1x lot of meters of leds ( addressable are better )
- few step down 5v ( if you run a lower voltage leds compared to the battery )

You have to be creative, I decided a bit randomly how to place my strip of leds and based on that you have to think what kind of animation you can display.

Best way to stick your leds on the jacket is to saw them a bit every 20-40 cm then put a piece of fabric on the top to avoid people grabbing the strip or get stuck somewhere.

If you are lucky enough, you will have a jacket with more than one layer of fabric, so you can run cables inside the jacket without touching them when wearing the jacket, and remember to find one with some big pocket inside to store battery and arduino.

The microphone is the tricky one to place, it took me a while to stick in the right position but with some sewing and hot glue everything stayed in position.

Remember, try to find the best position to fit everything and close to inside pocket to avoid to pull any cables that will stop the fun.

The battery is up to you, in my case I decided to use a 5v addressable leds that will consume 3.2 A and one lipo 4S 4000 mah to power them. The battery life is about 6-8 hours but it can be extend by lowering the brightness via code.

In addiction, I had to use 3 step down 5V, be sure to use a switching converter to avoid any lose on the conversation. I bought few of them from HobbyKing and they are UBEC converter.

Dont forget to have two batteries, one for the Arduino ( can be a 9v battery ) and one to power the LEDs, this because you might want to have all the possible current to the LEDs and avoid any "power down" or "frying arduino" due to the higher current.
It might sounds silly but it's just less work to do and much more safe.

I got a fuse in my jacket between the battery and my leds strips, just in case there are any shorts, I wont burn =).

I am not a great guy in terms of design and animations, so I had to watch some youtube videos to get some inspiration. I have implemented 4 modes on my jacket and 6 mode for the brightness&control.
The 4 modes shuffle every 60 seconds and they do react with sound or when I change to manual, they read random values to replaced the microphone. 

I have implemented the green button to switch between 6 modes: Microphone, Microphone 50% brightens, Microphone 20% brightness, Manual, Manual 50% brightness and Manual 20% brightness.

To have a quick access to the operation of the arduino, I soldered a switch to turn it on and off.