1

I'm using sim900 modem with raspberry pi, I'm able to connect to server using AT command for TCP, but when I try to send mqtt Publish packet as follow(I used tcpflow to get this packet from mosquitto library):

Serial.print("0");
Serial.print("0x10");
Serial.print("0x0");
Serial.print("0x8");
Serial.print("ABC/XYZ");
Serial.print("HELLO");
Serial.print("0x0");

it doesn't work.

dsolimano
  • 8,870
  • 3
  • 48
  • 63
amg
  • 127
  • 1
  • 3
  • 12
  • 1
    We will probably need a little bit more information to be able to help here. Are there any error messages on the broker side (assuming mosquitto run with -v to get more details)? Also rather than just using tcp trace the spec is available from here: http://mqtt.org/wiki/doku.php/mqtt_protocol – hardillb Jun 03 '14 at 14:10
  • As @hardillb says, more details are required. Have you sent a CONNECT first? Is the above all that you have sent? Sending a 0 first (which would be the command byte) is never correct. – ralight Jun 03 '14 at 16:09

1 Answers1

2

Follow this tutorial to connect internet on Raspberry Pi using SIM900 modem. Download 'sakis3g.gz' from Here. Use Mosquitto client library for MQTT pub/sub functionality. It worked for me :)

Steps to enable internet on 'Raspberry pi' using SIM900 :

  1. Enter this on terminal sudo apt-get install ppp isc-dhcp-server usb-modeswitch

  2. Then download sakis3g from Here

  3. Unzip package using gunzip sakis3g.gz

  4. Make file executable chmod +x sakis3g

  5. Run sakis with GUI option sudo ./sakis3g --interactive

Now follow onscreen instructions. Good luck! :)

amg
  • 127
  • 1
  • 3
  • 12