Jump to content
Sign in to follow this  
Fabinhou

App in PC to communicate with MSP430 and a website

Recommended Posts

Hello. 

I don't know if this topic fits on this forum session, but I'd like to know if some of you have any suggestion to me.

Let me explain:

I'm programing on a MSP430g2553 a device that can count the numbers of minutes that a driver is parked on a public parking spot.

Each minute is a charge. This charge the user can buy from a website and then, connecting the device via USB to computer, I need somehow to pass the information from the website( how many charges the user bought  ) to MSP430G2553. I already programmed on the microcontroller the USART communication needed. 

All I need now are some ideias:

How can I pass the information from the website to the microcontroler via USB?

I already did some researchs and I cant find a way to communicate direct from a website to the USB ports due to the security (some consider that it's not a good idea that website can access USB ports).

So I was thinking about developing an application that can communicate with USB and also can access the website and get the information needed to that user. This application could be in C#, C++, C, java, VBA or anything else. But since I never used any of these languages on a PC application, I don't know if it's possbile to access the website from the application and then finally send this info via USB to msp430g2553.

 

Does anyone already developed something similar? 

 

Sorry if I wasn't very clear.

 

Thank you in advance.

 

Share this post


Link to post
Share on other sites

The way I see it is:

Sensor detects user on parking place

Sensor tells server vehicle is parked.

User buys credit on website (Server).

Website (server) tracks everything.

 

When credit runs out:

- Server sends text to user's cell phone.

- Server calls for towing service if fee not paid.

- Server sends request for unpaid fees.

 

So most everything except detecting the vehicle being parked is handled server-side, not on the microcontroller.

Maybe a little MCU processing to handle payments made "at the vehicle" and transferred to the server could be done, though.

Share this post


Link to post
Share on other sites

Might help to have a little fuller explanation of the system designing.

(is the MSP430 part of some portable dongle that user carries or puts in car, or is it just part of parking lot sensing system, or what...)

 

One way to handle communication from web server to a device like this would be to use a microcontroller with a network interface.

There are lots of examples of devices that put a display, or a toilet, or kill a watt, or what have you online in this way.

The microcontroller is programmed to provide a simple web server and to talk to whatever device you want to program.

 

There are undoubtedly APIs for extending web servers to do this also, but if you are more comfortable programming a micro this might be easier for you.

There is surely example code out there to do what you want (I would search for support/programming information on whatever web server you are using - Apache, etc.)

 

If the user is supposed to connect the device by USB - be sure to consider robustness of the connectors (number of insertion cycles, easy of replacement when

somebody breaks them, protecting the upstream system from electrical insults, security for upstream system, etc.),

also (depending on how critical the system is) may want to consider system security for your dongle and communications (i.e. how to discourage reverse engineering/spoofing the device protocol.)

 

Using a separate micro as the upstream from the USB might help with security (system is too simple to know what to do with more complex USB devices, e.g.)

Share this post


Link to post
Share on other sites

Apparently there is an API in chrome that can talk to libusb through JavaScript, I think through that magic a USB to web server bridge could be created . Another option is to use RNDIS on the micro to interact with server via rest and tcp/ip. G2553 couldn't do either that though, would be better to find a low cost micro with USB hardware

Share this post


Link to post
Share on other sites

Thank you for responding.

After a lot of searching, I discovered that there is a plugin  (a .dll file that we can add to chrome directory) that allows the communication from a website from the client side to a microcontroller using javascript language. This is the plugin I used (jUART https://github.com/billhsu/jUART ). 

 

If I didn't have used this plugin I could build and Chrome Extension and a Chrome App. Like Lgbeno said, there is a Serial API for chrome app and extensions developers.

 

In Chrome you can develop Packaged APP ( that aren't tighted to websites, are offline ) and extensions (that are strongly tighted to websites). But for what I searched, it's not possible to use the serial API  straight from a chrome extension that is connected to a website for security reasons.

 

So you can build a Chrome Extension that communicate to your web site, and send the messages from message passing api to the Chrome App. Chrome App will receive the Extension messages and pass it to serial port via Serial API. The other way around is possible too.

"Website javascript block <-> Chrome Extension <-> Chrome App <-> Serial Port"

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×