Project Thread: Electric Go-Kart with Remote Kill Capability

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
Post Reply
spynappels
Posts: 10
Joined: Wed Jan 25, 2017 11:34 am

Project Thread: Electric Go-Kart with Remote Kill Capability

Post by spynappels » Wed Jan 25, 2017 12:21 pm

Hi All,

I've started a project with my father to build an electric go-kart for my children using some 24vdc wheelchair motors, PWM motor controllers and a Wimos D1 mini board, with the control code written in MicroPython.

This is likely to be a long running project with many iterations and I'll likely ask many, many questions along the way. However, I'll also post pictures, videos and code so that if any one is interested, they can follow the build and provide encouragement, feedback and raucous laughter at our attempts.

I will use the ESP8266 primarily for it's WiFi capabilities, as PWM control can be done by pretty much any MCU, and I want to be able to use a smartphone to either kill completely or else reduce the speed of the motors on demand. Eventually I may also look at using a heartbeat between the smartphone and the MCU to drop the speed if the go-kart moves outside a specific range of the smartphone or something, but I'm starting with baby steps.

So if anyone would like to weigh in with initial comments, feel free and I'll hopefully get some details of the basic motor controller working soon.

Stefan

spynappels
Posts: 10
Joined: Wed Jan 25, 2017 11:34 am

Re: Project Thread: Electric Go-Kart with Remote Kill Capability

Post by spynappels » Thu Jan 26, 2017 12:01 pm

Ha! I knew it wouldn't be long until I was back to ask questions.

Is there an easy option to use non-blocking sockets in MicroPython currently?

I have created the socket as non-blocking and put the code to read from the socket in a [code]try:[/code] block, with the other code in the [code]except OSError:[/code] block, but this does not do what I want.

The code in the except block runs fine, but when I try to open very simple static webpage, either nothing happens or the esp reboots/resets.

I'm not sure if using select is an option but I'm not sure it is supported for sockets on MicroPython, can anyone point me to some information on using non-blocking sockets correctly?

Thanks!

SpotlightKid
Posts: 463
Joined: Wed Apr 08, 2015 5:19 am

Re: Project Thread: Electric Go-Kart with Remote Kill Capability

Post by SpotlightKid » Thu Jan 26, 2017 12:43 pm

Hi Stefan,

Welcome to the forum and MicroPython! Sounds like a fun project. Keep us updated!

Chris

User avatar
kfricke
Posts: 342
Joined: Mon May 05, 2014 9:13 am
Location: Germany

Re: Project Thread: Electric Go-Kart with Remote Kill Capability

Post by kfricke » Thu Jan 26, 2017 5:14 pm

To be honest, I would suggest to avoid the ESP8266 port for your endeavor. This port is in my humble opinion by far not mature enough to run systems like you describe.

My suggestion would be to use a pair of pyBoards and NRF24L01+ radio units for this. They are rock solid and can be used for such an environment at least as good.

Just a few reasons coming to my mind why to avoid the ESP port with TCP or UDP sockets for your project:
  • ESP TCP sockets are by far not rock-solid. We have learnt this in various situations. Globally catching exceptions employing thw and WDTs and simple rebooting the MCU are the current way to go.
  • You do depend on Wifi infrastructure, which i'd assume you are running from the AP mode on the ESP or you smartphone. The mixed mode on the ESP8266 port is to be avoided at all costs. There have been even more issues with unstable communication when using AP and STA mode at once.
  • When putting the health of kids into the hands of a software stack, i'd choose the most robust and simple one.
  • Not to forget that moving around with the Go-Kart places you in continuously changing Wifi environments (or let me call it "Wifi weather")... a real nightmare! NRF24L01 radios do also use the 2.4 GHz band, but are far simpler and thereby recovering much faster from such conditions.

Post Reply