First, big props Gordon for a fantastic idea and product!
I'm just starting out on a project to add accent lighting in my car. I'm using WS2812B RGB light strips. The tutorial on the programming a similar LED lightstring was extremely helpful.
I will have several picos in the car, not easily accessible when everything's buttoned up and the trim is all put back. I'd like to be able to connect to any of them wirelessly and ideally interact with my laptop right in the IDE as if it was connected with a USB cable... is this possible with either the BT or wifi modules?
Also, what sort of IPC is available over bluetooth? I'd love to be able to easily hack up some app on my Android phone to control the things in addition to the LIN bus traffic I will be monitoring to set colors, intensity, etc.
Heck, the best way to do this would be to put a single pico on the LIN bus to sniff, then control the lighting via wireless talking to them.
Any/all advice and pointers to help me get the wireless part of this figured out is greatly appreciated!
Perhaps the most straightforward would be to use an esp8266-01 module for each pico, although if all were in station mode, you would need a central router to talk to. If there were in ap mode, you would have to connect to each one in turn to send updates.
You possible could have one in ap mode, and have the other unit and your phone connect to that ap, so that everything is on the same network.
@Wilberforce, great suggestion. If it is a AP, can it also be or host the server, and when so, how would the server communicate? Can the server use the AP as its wifi?
I think one of the easiest is to use an HC-05/HC-06 bluetooth module - you can get them pre-wired with 0.1" headers, or there's a 'shim' for connecting them to a Pico: http://www.espruino.com/Bluetooth
When you attach bluetooth, the Pico automatically comes up with the console on the bluetooth connection - so with your phone/PC you just connect to the Bluetooth serial port and then program exactly as you would if you were connected via a cable (even with the IDE). It's a bit slower because it's 9600 baud serial, but it's not too bad.
You can also then just send JS commands straight over and they'll be executed - eg. digitalWrite(LED1,1)\n or dimLights(55)\n.
You could connect an ESP8266 WiFi module up, but the issue is that it requires the Pico to be running some JS code to interact - so if you broke your Pico's code, it would be difficult to recover (I'm hoping at some point in the next few months I might be able to make a firmware where that isn't a problem though).
Another option is to run esplink on the ESP8266 - this turns it into a web-enabled com port (a bit like with Bluetooth) - and as long as you then connect serial to B6/B7 you'll be able to access the Pico regardless of whether the code on it has broken or not.
... or you could just use an ESP8266 running Espruino directly (and no Pico), but you don't have quite the same amount of IO available to you.
Thanks Gordon! The HC-05/06 sounds like an ideal solution. I have lots of experience developing Android apps, and my "vision" was to be able to control directly from my phone. This will work quite well. On my way to order a module...
I haven't done any BT development, however, so I'm new to all the code "help" available to do things like transfer data, etc. Is there a stack/library/layer available that simplified IPC across BT in a robust way? I'd rather not create my own protocol to run over a serial BT connection to reliably transfer data, messages, etc.
I haven't actually done any on Android either, but when I looked last time:
Hope that helps!
Don't worry about formatting, just type in the text and we'll take care of making sense of it. We will auto-convert links, and if you put asterisks around words we will make them bold.
For a full reference visit the Markdown syntax.
© Espruino, powered by microcosm.
Report a problem