5

I really need to some help. Nothing broken, just needs some guidance. I have an Arduino Uno and AdaFruit CC3300 Wifi Shield. I have built a well functioning solar powered weather station and have saturated every analog and digital io. All is working well with the IDE, my wifi sample code runs perfectly. I am using IBM Bluemix and learning a lot although nothing I have done in the past. I am an Computer Engineer having done some software and mostly embedded hardware my entire career.

Unfortunately, I just didn't have enough space to get the MQTT client running on the Uno despite a lot of optimization. Plenty of good guidance on that out there and on Bluemix itself, but I can't use it.

Here are my questions;

  1. I am thinking the a web socket is my best play to keep things lite. ----- Is that right? ---- I need to essentially pass a JSON string of about 300 characters (all sensor data and other stuff) everything 5 minutes. That's it. I just can't figure out how to get that up to Bluemix app using Node Red (learning JavaScript as well). There is a web socket node too. It is not explained well anywhere that I can find at least such that a mortal man can understand. I have also run the webclient sample for that wifi library, but can't make the jump. Just not there experience wise.

  2. I believe the AdaFruit CC3300 Wifi shield library can setup a web socket on the client side so no further space burden. ---- Is that right? -----

  3. My goal is just to be able to get this JSON formatted data up to my Bluemix app and displayed in the Node Red debug console. I am fully setup on Bluemix.

Appreciate any guidance to steer me in the right direction. dpguitarman

DPGUITARMAN
  • 161
  • 1
  • 2
  • 12

2 Answers2

2

Rather than going through the need for a protocol upgrade to get a WebSocket connection why not just do a simple HTTP POST?

hardillb
  • 54,545
  • 11
  • 67
  • 105
  • That sounds good. I have been killing myself to figure out the raw data to send to do that for a web socket. I don't have any room for any more clients so I need to go as raw as possible. I will investigate simply opening up the TCP connection with the CC3000 library then sending an HTTP Post. I have never done any of this before so good times. I'll give it whirl. Thanks! – DPGUITARMAN Jan 20 '16 at 03:34
1

I think the websocket client is the best solution, lightweight for arduino, and well integrated with node/Bluemix and so on. On Arduino side you could start from this library https://github.com/billroy/socket.io-arduino-client to setup an agent returning some values on the websocket. On Bluemix side nodered or also nodejs could be good solutions, asking just some lines of JavaScript for integration, if your arduino will return a well formatted Json

v.bontempi
  • 1,562
  • 1
  • 9
  • 10
  • Thanks! Just don't have room for any more clients and hoping to send raw websocket POST from the arduino uno. I could not find a single example of how to do that raw. Every example was couched in other libraries so I couldn't see what was going on. I can't even figure out how to do use the echo server at websocket.org. Struggling, but having fun doing so. Anything you can share would be great. If I could figure out how to use the cc3000 web client TCP connect (which works fine) to then POST out to the websocket echo server and get a simple string returned, I would be in heaven. – DPGUITARMAN Jan 20 '16 at 03:39
  • 1
    In this case I suggest to work with a simple http connection client (arduino) to server (Bluemix?) and use an http post. Cc3000 works fine with this kind of requests. Moreover as I found here you could have some problems with websocket on arduino http://stackoverflow.com/q/23057337/5110123 – v.bontempi Jan 20 '16 at 07:43