I'm just starting a new project, a thermostat connected to wifi and controlled anywhere from mobile phone. I've seen the Nest Thermostat which has a Cortex-A8 but I need to make a simpler and cheaper one, just a Cortex-M3 + wifi + temperature sensor, no screen.
The Android app (developed by other people) uses Firebase, so my embedded system should use it.
I've selected a tiny RTOS, CyaSSL and lwIP, but this is my first Internet project and I need help with Firebase and everything related to Internet.
Is a Cortex-M3 suitable to connect to Firebase?
Is the selected software suitable to connect to Firebase?
What software do I need besides the selected? (Firebase API REST, JSON parser... and any software I don't even imagine)
I haven't found almost any info about such a system, there are some questions but most of them have no answer.
Thank you in advance
As I understood, to use the REST API you just need to implement the HTTP protocol, there is many RTOS that have full HTTP and HTTPS implementation.
I never used, but I know that mbed (http://mbed.org/) is designed for IOT,it is free, and developed by Arm, so it is probably the best way to go.
Just look for a C/C++ JSON Parser lib if it is not ready, otherwise you should develop one for yourself, it looks pretty simple.
Related
I think this is maybe a bit general question but I am having trouble understanding if mbed client is capable of doing what I think it does.
I have managed to buil and run correclty Mbed Client on a K64F board. I have connected it to the server and the API runs perfectly with I/O elements, led and button. If I am not mistaken the client it is supposed to be able to update software executed on the board (even Firmware?). I have been searching but I have not found how to do this. I find references quite confusing on this issues.
Is it posible to define a resource as a software pakcage that is uploaded (let's say with a PUT request) and the executed (with the POST request)?
Is it posible update the firmware itself?
Any reference or example where I can see how it works?
Is the M2MFirmware class related to this posibility?
In a way, yes. LWM2M has firmware update resource specified. However, mbed Client can only do updates right now if you are connected to mbed Cloud - which is currently only available for partners - plus you'll need an OS which supports firmware updates... Just defining a resource is not enough as you need a bootloader capable of doing firmware updates too.
mbed Cloud + the updated client should be available to general public soon. Then the update capability will be available too.
I have questions about programming in BlackBerry Devices OS 5 - 7. Is there a listener that can listen if the device is just connected to internet connection? The task of my app is that if the device is connected, it will send a http request right away.
Looking forward to it.
Best regards,
Hammy
The listener you want is called CoverageStatusListener. Have a look at the API: CoverageStatusListener and CoverageStatusListener OS6.0+. Note the two flavours - you might want to use the extended version in your OS 6 and above apps.
But that said, coverage is only 1/2 the story. You might have good coverage but no access to the specific web site you are targeting. Another common problem is things like WiFi Hotspots - you can be talking quite happily on WiFi, but unless you have signed in to the Hotspot, you are not going to be able to communicate with your web site. So the many links that have already been provided by Signare (in the comments for your question), are useful. Here they are again, plus one more that I think is useful:
how-to-check-availability-of-internet-connectionwifi-gprs-edge-in-blackberry
how-to-check-for-an-active-internet-connection-in-blackberry-sdk
how-to-check-internet-connection-in-java-in-blackberry
how-to-check-network-connection-type-in-blackberry
In previous versions of Arduino, the limiting 8-bit microcontroller board, it seems that implementing HTTPS (not merely HTTP) was almost impossible. But the newer version of Arduino Due provides 32-bit ARM core - see spec here.
I tried to check several network libraries (libcurl, openssl, yaSSL), but I didn't find anyone that was already ported to work with Arduino Due.
OpenSSL is probably too heavy to be able to run on this processor, but I believe that yaSSL as an embedded library should be possible to do.
Do you have any information of a library that I can use to trigger HTTPS requests on Arduino Due?
Unfortunately this is too long for a comment.
► No out of the box solution
From what I have gathered, there is no straightforward solution for a webserver running on the Atmel SAM3X8E ARM Cortex-M3 CPU that outputs HTTPS out of the box.
Texas Intstruments provides better options at the moment using their boards equipped with a Stellaris Microcontroller ARM Cortex-M3 CPU.
► Alternative
There are several options available that render cryptographic functions, based upon which one could lay out and implement a simple secure communication protocol that communicates with an intermediary device, which in turn facilitates Rapid Application Development and SSL.
This intermediary device, for instance an off-the-shelf 70$ Android smartphone that keeps your project mobile and connected, runs a service on a specified port which in turn communicates with Amazon SQS. Already available. This may sound ugly or tough, but is much easier than doing the programmatic groundwork for a webserver with full TLS 3 support on the Arduino. Given the proper motivation the latter may be easy, but not if one just wants a fast pragmatic solution to one's own project.
► Cryptographic libraries
crypto-arduino-library http://code.google.com/p/crypto-arduino-library/ (not maintained since 2010)
matrixssl
mbed TLS (formerly PolarSSL)
wolfSSL (formerly CyaSSL)
► Discussions
Following is a list of discussions to get you started:
HTTPS alternative on Arduino
SSL from a Microcontroller
Lightweight Packet Encryption
Many of these libraries would still need to be adapted, but community experts can help you with that fairly quickly.
Good luck! If you are at liberty to upload your final project to github then you just gained a thanks and a follower.
IMHO Arduino (including the DUE) is the wrong tool for heavy and/or encrypted web based communication. I would strongly suggest to look for more appropriate hardware in the same size and price range. As soon you get into https you are close enough to also want a lot of the other stuff that real operating systems provide. With other words I suggest to go for something like the Raspi. Similar size and prize but way more powerful, especially it can run Linux. --> HTTPS becomes simple.
The big problem with https support on an arduino is the danger of overloading your processor which could make the project unviable.
Even embedded platform targetted solutions like PolarSSL can eat up too much memory and use too much processing power. Remember that even on the most streamlined implementations, SSL support is going to have to be generalized for wide adoption and will include components that you won't find necessary. There's also the question of which Certificate Authorities you will trust and how you will communicate with them for things like certificate revocation.
I would look instead towards a solution that isn't as broken on the surface for your needs. Something like CurveProtect, which is an implementation of CurveCP.
Of course, your decision will largely be based on what you want to do and how much time you want to spend figuring the problem out. PolarSSL has a footprint that can be as small as 30K (more typically close to 100K).
I am currently building a chat server (meebo style).
The architecture is something like this.
Bitlbee over libpurple is on host B. Its a trivial server on data center.
User communicates with bitlbee via web server (just like meebo) on Host A. The backend of this web server maintains chat session. It just translates the user commands to proper bitlbee comamnd and sends back to host A.
The most important part here is that host A will be deployed in embedded Linux.
I have 2 questions.
To keep the chat session persistent I am thinking of using node.js. As its much more easier to create a real time application with persistent connection. But I doubt if its supported in such platform.
If I use C instead of node.js (I am not using any web server) I can talk to the irc server at host A by libirc. But how do I implement all the web server features in C (like session, url/cookie/post data parsing etc) ?
Also if you think my approach is wrong or there is a better approach please tell me how can I improve this architecture?
Note: This is NOT a high volume chat server.
If building V8/Node.js is prohibitive on the embedded platform, the next best thing would be to take the event loop and platform layer (libuv) and HTTP parser (http-parser) of Node, both written in C and use those as a starting point. These are the same libraries used to build Node.js so they are battle tested and will give you the performance characteristics you seek.
Ryan Dahl, author of Node.js, demonstrates exactly how to use libuv and http-parser to build an asynchronous web server in C.
Put a ZNC server between Bitlbee and the web-based IRC client. Bitlbee will think that the user has never logged out and ZNC can maintain a backlog of messages until the user connects again with the web client.
I would try to go with node.js if that is your choice, also what embedded system is it? As knowing that would help more. Also, another plus for node.js is that it does have session handling built it, but if you wanted to do it in C try and see if you can get a sqlite wrapper running on the embedded device to store the session information.
But, if possible stick to something with less work on embedded devices, feels bad to reinvent a lot of stuff or have to fiddle with compile issues for your device.
I want to get some ideas on how I might control a video camera through an IP address. I have an API to control pan and tilt from a local machine. The code is going to be in C/C++ on Windows. I am still designing if I want multiple cameras controlled from one application or have a one camera to one application. Would SOA be a useful architecture to structure my messaging?
I think you could be well served by something like REST for a task like this. Executing a command towards a REST server is really intuitive and simple, which sounds just like what you need. I'd probably make some kind of application that would be running inside a web-server, since this would handle most of the infrastructure, including authentication if needed. I'm sure both apache and IIS could do this for you quite easily. Even though your API is coded in C you could also consider using some higher-level scripting language as a client to the API (inside the web server).
SOA sounds a little overkill for a task like this.
I did something similar for aproject in my university. What we had was the cameras connected to a LAN and with message passing was very easy to communicate with them, is the same that communicate with any PC. We had the same application to communicate them. You can use SOA or any architecture you consider convinient, that depens on your application.
For our case was just an ad hoc architecture, it was not a complex thing.
Hessian is nice. It is basically REST, but has a binary protocol which is more efficient than XML and it also lets you make calls from other languages quite easily. So, you could develop the client GUI applciation in C# and the server in C. There are free libraries for a few different languages available.
http://hessian.caucho.com/