I posted in telemetry about wifi access on the RCP, and that I had purchased a chip. However that chip requires a lot of embedded (c-like) setup and I don't have the time to go through all that . So... instead I found a really convenient chip, ESP8266, which runs NodeMCU allowing for control through Lua scripts for WiFi connections.

I wanted to make a serial interface between the RCP and this chip using LUA on both sides, allowing for some sharing of code, and was wondering if streaming through the LUA UART interface would allow for high quality streaming as is done with the telemetry/bt modules.

My second thought was to make this wifi module spoof the current BT module you guys have, and just directly hardcode things like host/port into the NodeMCU code, to act like the RCP app would. If doing this is better than using Lua, do you guys have any documentation on the BT interface so I could spoof that serial port connection?

I took a quick look through the firmware code, but haven't been able to piece it all together. Keep getting lost between whats a settings communication and whats a streaming communication in regards to BT. And if I had more time I would probably try to add my own firmware module for NodeMCU streaming and what not, but right now I'm trying to find the quickest/easiest way to get wifi so I can concentrate on riding.

So in summary:

1) is the Lua library (module? plugin?) quick enough/good enough to stream serial to my wifi module (including access point information before streaming). (note: also figured this path would allow me to use the auxiliary streaming port (or telemetry connection in the box) for my wifi module and the BT module is in the firmware, so could have an android phone and direct wifi setup at the same time)

2) if not, is there docs on how to spoof the BT module, so that RCP firmware thinks its communicating via bluetooth but instead is using my module.

And when I get this stuff working I will open source my code so others can see/use/help work out bugs. The ESP8266 is very cheap and easy to use, so i'm sure other people might be interested.

_________________vroom

Mon Dec 07, 2015 2:30 am

stieg

Joined: 20 Dec 2013
Posts: 101
Location: Madison, WI

The second approach sounds more realistic from my perspective. The BT device is treated as a simple NULL serial modem, so if your device is already setup to work the way you want and can handle a raw stream, then all you need to do is simply ignore the setup commands and listen for the JSON stream.

Thank you for the reply stieg. So I am on step 1 of this project which is to stream fake data from the wifi module. I managed to get that all setup, do auth, and then send meta and a stream of data.

However the data showing up on the race-capture website is not right. Is there an order I should send the data in? I'm sending the data in the same order as the meta was sent, but it doesn't work. I also tried alphabetical and that didn't work either...

Meta:

Code:

do send_msg: {"s":{"meta":[{"ut":"G","nm":"AccelX","sr":25},{"ut":"G","nm":"AccelY","sr":25},{"ut":"G","nm":"AccelZ","sr":25},{"ut":"Volts","nm":"Battery","sr":1},{"ut":"Miles","nm":"Distance","sr":50},{"ut":"Count","nm":"LapCount","sr":1},{"ut":"Min","nm":"LapTime","sr":1},{"ut":"Degrees","nm":"Latitude","sr":50},{"ut":"Deg\/Sec","nm":"Longitude","sr":50},{"ut":"Count","nm":"Sector","sr":1},{"ut":"Min","nm":"SectorTime","sr":1},{"ut":"MPH","nm":"Speed","sr":50},{"ut":"","nm":"Time","sr":50},{"ut":"Deg\/Sec","nm":"Yaw","sr":25}]}}

Data:

Code:

do send_msg: {"s":{"d":[2.5,2.5,-2.5,5.1,0,0,0,39.745716841307,139.07335743824,0,0,11.929658833858,0,50,30]}}

do send_msg: {"s":{"d":[2.5,2.5,-2.5,5.1,20,0,1,36.690151892458,144.0525280759,0,1,18.843932793869,1,50,30]}}
do send_msg:

Yeah I did the auth part, just didnt include it in my post here. Then after auth i was ablento see live data on race-capture it just kept matching data to different meta. So my battery value would get distance values for example, even though I sent the meta and data in the same order.

I used some of the json samples, but I must've overlooked the tick key!

1) What is Interval and UTC (I know what UTC is i just dont know what this data should mean, why would the RCP have access to a true UTC time... from gps?)
2) I'm not sure of the difference between CurrentLap and LapCount (is LapCount total lap count?)
3) I am also not sure how to use LapTime vs LapCount. (same as Sector vs SectorTime)

I tried this:

Code:

LapCount=1,
LapTime=count/60,

but the lap time and lap count increased together with the value set in LapTime!

Nice to know about the max limits for name and units, whenever you guys get a chance document this stuff in github or api docs . I mostly say this because I noticed the announcement of podium, and I'm sure transitioning my code to podium is going to have similar hurdles, if the api changes.

Okay so the values I streamed was this below:
linearly increasing Time, Distance, LapTime, SectorTime

From what you said about LapTime and CurrentLap I see what my problem is. I thought LapTime was the current lap time, but rather it is the last lap time. So I sent a new LapTime that increased at the same rate as Time (I wanted to simulate a long single lap for simplicity). But I never increased the LapCount. So it seems that live data thought i was increasing laps as I kept sending new LapTimes, but LapCount never increased so when you refresh the browser it sees that there was only ever LapCount=1 and only loads the first lap. This might be a bug on the server side, but its definitely a misuse of the API on my part.

Quote:

Nice to know about the max limits for name and units, whenever you guys get a chance document this stuff in github or api docs Very Happy

Definitely. We still intend to cleanup the API at some point but yeah this has been a TODO for some time.

Quote:

From what you said about LapTime and CurrentLap I see what my problem is. I thought LapTime was the current lap time, but rather it is the last lap time. So I sent a new LapTime that increased at the same rate as Time (I wanted to simulate a long single lap for simplicity). But I never increased the LapCount. So it seems that live data thought i was increasing laps as I kept sending new LapTimes, but LapCount never increased so when you refresh the browser it sees that there was only ever LapCount=1 and only loads the first lap. This might be a bug on the server side, but its definitely a misuse of the API on my part.

Yeah... the nomenclature is definitely confusing and could use some love.

RE the LapCount, RCL triggers a lap save when the LapCount changes. So to get laps to store, you need to complete the lap (ie increment LapCount). That will probably get you what you want .

My bike has been in the shop, hence working on this project with only mock data. But I get the bike (with RCP) back this week, so then I'll be changing my mock UART interface to a real one and trying it with real Lat/Lon values.

The rest of the values will also hopefully be trivial passing of information uart->json. If not I'll have to re-do the firmware to free up some more RAM haha. The nodemcu is so constrained

_________________vroom

Wed Dec 16, 2015 4:28 pm

stieg

Joined: 20 Dec 2013
Posts: 101
Location: Madison, WI

Killer. Let us know how it goes. Also feedback on motorcycle data would be great. Would love to know what low hanging fruit can be addressed to make it more useful for ya.

The following two were done using RCP lua script and init(4, 9600, 8, 0, 1) and using the same settings on my ESP8266

3) Connect RCP TX -> ESP RX, and *could not* get any data at all
4) Connect RCP RX -> ESP TX, and *could* get data *but* it was always wrong. e.g. (AT became XZ). And many other things became QPGDM or something (maybe an error message... something about GodDaMn I presume)

You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot vote in polls in this forumYou cannot attach files in this forumYou cannot download files in this forum