Sunday 16 July 2017

E3276 and my fight to get it working


Issue


I wanted to upgrade my webcam system with a new dongle which supported 4G due to the carrier being upgraded and because 4G is everywhere now.
I bought a new dongle from Ebay which was pretty straight forward, just needed an unlocked one and I got it.
Following few tutorials, just because I couldnt remember exactly how to switch mode to CDC mode, I ended up to find the whole process difficult and unsuccessful.

Investigation


First, Huawei is an amazing dongle, second, routerunlock.com is an awesome website!
By Googling around, I found out that my dongle was fully working but running a wrong firmware which allows PPP mode but this is not what I needed.
Here is my discovery, Huawei modem have two communication:

  • Serial device
  • Composite or Ethernet device
As you can presume, what I wanted is Ethernet device.

Specifically on this model, the version 21 and before are SERIAL and 22 or above should be ETHERNET.
Using linux, I could trigger the mode by typing (remember 1506 needs to be discovered by doing lsusb):
usb_modeswitch -v 12d1 -p 1506 -J -R -W

Then your device will either go into Serial or Ethernet device.

If you are unfortunate like me that you can only access the model via serial, it is best to install a serial client which allows you to get IMEI number and firmware.

AT way


When you discovered that you device is using a Serial device, open it with a serial client ( I used arduino just because it was open at the moment),  and type:
ATI
You should see something similar:
Manufacturer: huawei
Model: E3276
Revision: 21.263.03.00.78
IMEI: 863**************
+GCAP: +CGSM,+DS,+ES
Remember to add CR at the end of every command!

Now you got some information, in my case I found out that I am running a firmware 21 and I got the IMEI to general the password.

You need to find out what exatcly model you got, by typing AT^FHVER which should return somthing similar:
^FHVER:"E3276s-150 21.263.03.00.78,CH1E3276SM Ver.C"

Now I got everything:

  • Running 21 firmware
  • I got my IMEI
  • I got the model which is E3276s-150

Password


You need to generate a password from your IMEI, there this website which ask to login with your G+ then ask for a G+ like and then you will get the password for free. Not a bad deal!

Firmware


Now that I have all the information I can go ahead and flash my device with the latest one from this website , you could possibly find another website but this worked for me.
Remember to flash first WEBUI then the FIRMWARE, otherwise you are going to run into issues like I had.

Remember to double check the model, mine was 150, yours could be different.

Once you have flashed the two file ( Firmware and WEBUI ), your device should be ready and your should be able to open the page http://192.168.1.1

What if you flash WEBUI as last

Without even thinking about it, I flash the firmware then the webui, unfortunately the webui software couldnt find the device and thrown me errors. The device itself was working and the API call did work.

The little trick is to be able to switch the mode by using the API or if you had a older version of WEBUI by going to http://192.168.1.1/html/switchProjectMode.html


Thankfully I found a just who made a curl script with the right parameters to switch and then I  successfully flashed my WEBUI

echo "<request><mode>1</mode></request>" | curl -X POST -H "__RequestVerificationToken:1099746139" -H "Content-type: text/xml" -d @- http://192.168.8.1/api/device/mode



Versions



Sunday 7 May 2017

Communicate between Raspberry Pi and Arduino

Intro:
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.

http://amzn.to/2pQXDUw

Communications:
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!

Connection:
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.


Code:
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:



Conclusion:
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