Remote Spark Web App

Hmm, can you use a computer and see if your SSID from your iPhone is available… and can you connect to it using your PC? You can also try plugging in your phone with the cable to a USB port on your computer and get a connection that way. Disable your other wifi/local connections to make sure you are routing traffic through your phone.

I’ve been using an ipad to test the iphone hotpot. Works fine with the ipad and I can see my ssid on there which corresponds to what the iphone says it should be. I don’t understand the part about connecting it to my computer via usb. What would that test?

I just unplugged my wifi and that made no difference.

But here is something interesting. I connected my windows machine to the hotspot and the ssid shows different there. It is basically the same but has funny characters in there that I don’t even know how to type. How can I change the ssid on my iphone? It looks like it is the iphones name but I have never messed with that before. I seem to remember doing that with itunes when I set up the phone.

Got it! It was the funny characters in my ssid. I don’t know how they got there. I took out the apostrophe and BAM, it works! The funny characters where right were the apostrophe was suppose to be when I looked at the ssid on my windows machine.

2 Likes

Ok, so now that I have the hotspot working, and with rather descent range from inside my house, I am trying to get your remote start example to work (all of my testing is using wifi though, not hotspot). I hosted the .html page on my google drive and inserted my core id and access token. Then I flashed the .ccp file to my core. Everything went smoothly except I don’t see any response on D7 when i press Start Engine. The button blinks rather quickly but maybe that is normal. And I do see success! at the bottom of the page but seems to be flashing once a second and not necessarily responding to pressing start engine.

Any ideas? I’m suspicious that google drive web hosting could be a problem but I don’t know another way to post the web page at the moment as this is all new to me.

Update: If I load the webpage on chrome or ie it seems less functional than on the iphone. It does not show any messages in the boxes to the right and I never see the Success! message at the bottom.

Success will keep popping up because it’s scanning the variables as well once every 5 seconds. You’ll see the success banner pop up a few times, once for each variable actually. It’s not the greatest indicator, but it’s a start. I’d like to maybe just keep it simple with like a red/green LED somewhere on the screen.

That’s strange that the button is blinking…

Can you try to just open the HTML file on your local computer and try it there? Should work. Then if you move it to Google Drive and it stops working… well, we know who to blame :wink:

Oh, by the button blinking I mean when you push it on the iphone is responds like it is being pushed but it is so fast it looks like a blink to me. I just opened the webpage on my computer like you suggested and it looks the same as when I open it from my googledrive on my computer’s browser. No messages in the boxes to the right of the buttons and no success message at the bottom. The buttons do work better though. When I press them they stay depressed until release the mouse button. I’ve got something hosed up I guess.

Thanks for all your help by the way. I really appreciate it! I’m having fun with the concept of this spark core.

Hmm…I just found the thread titled “Web app controller”. I followed your instructions there and also tried the simple spark controller files. I can’t get an action when I press the buttons whether on my iphone or launched on my windows machine. Sorry if I am posting in the wrong place. Maybe I should start my own topic for this.

I’m guessing you must have the coreID and accessToken variables not set correctly. Can you double check those again, they are at line 30 and 31 of the index.html file.

var accessToken = "0123456789012345678901234567890123456789";
var coreID = "012345678901234567890123";

I’ve checked this 3 times, copying and pasting from my web ide each time. Do I keep the quotations around the number? Should I reset the token and try the new token? I can use the tinker app just fine but I don’t know if validates my id and token are good since I don’t have to enter them manually.

Strange thing is that only on the iphone it seems to do something in that the text fields are populated and I see the success message. I tried one time without the quotes to see if maybe they didn’t belong and no fields populated on the iphone like before. So i figured this is what I would see with no or wrong numbers in the .html file. Where running the web app on the computer never shows any fields populated like the iphone.

You need the “quotes” around the number just like my above post. You also programmed the example Remote Spark app on your target Core, right?

If that’s not working, let’s get more basic… factory reset to get the Tinker application back on your Spark Core and try some curl commands or use http://www.hurl.it online or the Advanced REST Client extension for Chrome, and follow these instructions to toggle D7 HIGH and LOW:
https://community.spark.io/t/tinker-api-returning-1-failing-but-i-dont-know-why/1365/3

1 Like

I just uploaded the css and js folders to my webpage and it works now! I was not expecting that because I read on another thread where you said those files only made it look pretty, which it did, but not needed for it to work. Before trying that i did generate a new token but that alone did not help. And just to confirm, I deleted the folders and it stopped working. I narrowed it down to the js foldler. Without it it does not work.

I still can’t get it to work running from pc which you seemed to think it should.

I am going look into your last post thought because i think that would help me understand more how this all works rather than hacking code and not knowing what is going on.

I’m so happy I can start really having fun now :smile:
Thanks, again for all your help and for creating this example in the first place! When I heard about the core my first thought was wifi remote start. And when I found your example I ordered one right away. I am going to use an analog input to detect when the engine is running based on the increase in battery voltage when the alternator is going. Should be able to detect a drop during starter operation as well. That way I can report back that the engine really is running, in case it doesn’t start on a cold day.

1 Like

Ok, yes without the bootstrap code it will error and not send the request. Mine connects to the core and updates the variables, but will not work when pressing any buttons. So yeah you just need to have all of the files :smile:

Works locally for me, just make sure you have the JS and CSS folders as well!

That’s awexome that this inspired you to buy a Core. I feel honored. Welcome to the family! :smile:

1 Like

Yes, installed and working! I just started my jeep from a mile away (phone on 3g and jeep at home in wifi range). I’ve got the feed back monitoring the buss voltage so it reports “running” only if the engine really is running.

It occurred to me as I was doing final bench testing that 150mA might be a bit much for a constant drain on my jeep battery. I’ve read a bit about sleep mode and I guess I could put the core to sleep a night. Only time that would be problem is the rare occasion that I am leaving the house super early and can’t remote start it because it is sleeping. Or maybe it won’t be a problem. I figure I could add code that will sleep the core if the battery voltage ever gets below a set point. Any thoughts on that? Is there a low power mode or is 150mA the typical drain. I thought I read in the data sheet 50-150. Maybe there is something I can do to bring that down a bit?

1 Like

DISCLAIMER: I’ll be honest, I don’t know much about sleep modes, watchdogs, and interrupts; I only know that they exist.

If you park outside of a garage (or in a garage with windows), maybe you could use some sort of photoresistor to “wake up” the :spark: when the sun rises? If not, maybe use @bko’s time library to manually put the :spark: to sleep at a certain time and then wake it up after X hours have elapsed.

How are you triggering the start? Are you hooked into the bus system or connecting the ignition wire?

Thank you BDub for this post.

It’s been invaluble to me creating my 1st Spark Core web app.

I wish there were more projects / tutorials like this. Keep up the great work.
Col

2 Likes

I already had an aftermarket remote start module that uses relays to turn on the jeep and activate the starter as well as monitor various items. This module is just looking for a double pulse to ground signal to initiate the start sequence. Then another double pulse will shut it down or the 15 min timer will shut it down. So, I just used a digital output on the spark core to send this signal to my remote start module. I did put a small transistor in between but maybe that probably wasn’t necessary since the current draw was around 1ma, but I was being conservative. I would like to redo my installation and eliminate the start module and handle all of that with the spark core. And even better would be if I could get a hold of the jeep’s data bus protocol so I could control everything that way rather than relays and wires.

I've been thinking about this as well... and I have some CAN bus transceivers ... isn't OBD-II just a CAN interface? Easiest way to interface to it would be an OBD-II connector.

I’ve very familiar with OBDII, Modern cars with CAN are significantly different.
OBDII is a standard protocol for diagnostics with room for custom manufacturer features. The interface is nothing more than good 'ol modem AT commands.

Nobody builds fun stuff like starter and door locks into this interface. The CAN bus on these vehicles is how they do everything because they have the freedom to be proprietary. Keeps the starters costing $$$. :smile:

I have no idea though about what’s involved in programming to the CAN interface or even wiring up to it.

I’ve been using an adapted version of this Remote App for a while, with the PHP code to hide the Access Token.

It’s been working perfectly until this evening. I haven’t changed any code either on the Core or server. I can also still access the variables either via the “Spark Tools” website or by typing the “https://api.spark.io/v1/devices/…” URL into the browser.

I wondered if anyone else has just experienced this issue or whether it’s something to do on my end?