Making a complete servo motor module with the Electron or Mosquito boards

Hey guys, I am still working on the project, and once again find myself needing a quiet, brushless motor, which can have it’s speed and direction controlled. Mixing and matching existing off the shelf solutions isn’t really working.

Three times in one project I have needed this solution. Once for the drive motor that turns the thermal wheel, once for the fans in the thermal wheel based ERV, and now I am making an erv similar to the lunos e2 (which will hopefully have less marketing issues).

I am thinking I should bake some brushless gimbal motors and the Mosquito board into a complete working solution with a nema 23 connection interface (or whatever, but to keep it standard).

This would require obtaining some mosquito boards, which is not actually that easy, from what I can tell from the instructions on how to get them out of that small order pcb company, their process is not exactly streamlined. I have to search for more info on exactly how to interface to the mosquito.

I can do CAD to do the mechanical stuff, 3d printing, and I have sourced some commonly available gimbal motors for a relatively good price. I can do the testing ok. I can pay for the stuff. I may be able to get them into Amazon to sell them at a low price with quick shipping to others, as step which imo is important as people really don’t usually have the time or skills to roll their own.

Is anyone interested in collaborating on this? I suggest we dub it the Toad, (which consumes the Mosquito and makes it part of itself).

I would like in particular for it to be compatible with micropython, so I can use it with the raspberry pi pico. Do you think that’s practical?

Oops, it’s the Lepton, not the Electron, reading about it now.

Read up as much as I could about the lepton and Mosquito.

It’s not clear to me what the inputs the Lepton accept are. Like, how do you use it?

Features of the Toad should be:

  • accepts step/dir input in one mode, at least, it can accept other inputs by I2C or other interface, however that means I need to write a driver, too.
  • ideally should be closed loop using an angle sensor and magnet, but should be capable of basic function in open loop mode and sensorless mode
  • should at least provide some indication of how close the motor is to stalling, and a pin should go high when it stalls (very useful for sensorless homing etc)
  • some way to monitor and /or limit current would be useful.
  • quiet, relatively high rpm is the priority, because silent stepper drivers and stepper motors already work ok for lower rpms, like 10-20 rpm and below.

This would be good for : linear actuators, which to achieve good linear speeds often need higher RPM than mentioned. Quiet fans and other motion systems. Also being reversible and having controllable start up and acceleration is a step up over other ESCs.

Fundamentally, noise is a form of pollution. Reducing it is, like most pollution sources, often set aside, however it is important.

Since I designed the Mosquito and Lepton boards, perhaps I could help?


Ok, so in trying to figure out how to interface to e.g. a Lepton board, it looks like this is the way?Commander Interface | Arduino-FOC
Sounds like a good approach. However the link to the motor commands, which I assume has the good stuff i.e. how to actually command the motor to go to a certain position, at a certain speed or whatever, is broken.

I would be a little worried about how fast the system can respond. That’s kind of why I like step/direction inputs. The sub systems for arduinos and other mcus like the raspberry pi pico are relatively worked out for step/direction stuff. The built in timers and so on are used by the libraries and they can implement acceleration and keep track of (assumed) position and so on. There is stuff like GRBL that already uses this type of approach.

I think it would be a good approach to mimick.

The more I think about this the more I would like to do it. Valentine, do you think the feature list above is doable by modifying the Lepton design? How much work would it be, do you think?

Good find. I’ll try to fix it for the next release.

I think it is intended to link here: Full motor config | Arduino-FOC
In any case that page contains most of the commands in one place, and personally I usually use commander in this way (e.g. commander.motor(&motor,cmd);)

All of the commander docs we have are in the page and subpages of Commander Interface | Arduino-FOC
So all the links on that page should lead to one section or another there…

If you have any questions about it, please ask!

If you want to use StepDir, we have a class for that as well. You can use any pins for it that support interrupts, i.e. I assume pretty much any of the pins Valentine has broken out to the plug headers.

The Lepton board has four interfaces: SWD, SPI, I2C and Serial.

The SPI is better used for angle sensor of very fast synchronous chip-to-chip communications (up to 10Mbit/s).

The I2C is for relatively slower chip-to-chip, usually about 100kbit/s.

The Serial is also for chip to chip, unless you use an external Serial-to-USB converter.

Since the SPI, I2C and Serial pins on STM32 are multiplexed, they could also be used as any normal I/O pins. Some of them are also analog input pins. Also, if you really, really, really know what are you doing, you can use the SWD pins as I/O. I made sure I added to each header 3v and GND pins, so you can attach any external device and power it directly from the Lepton board, which contains a full-blown low voltage DC-DC buck converter with about 600mW 12v power and 300mW 3V power, that’s more than you’ll ever need to power any peripheral device or another Arduino. You could even run a small fan to cool the board on the 12V output.

I’ve got good news for you. The hardware design doesn’t need to modified. It’s all in the software you program into the Lepton board, and any other integrated board for that matter (Mosquito, too). That’s the whole point of having a good, integrated design. You get the board, program the pins and use them as speed/direction, or hook up another Arduino board and write the code for the two boards to talk and control each other, or directly control it with an external computer. Think of the Lepton board as an Arduino board integrated with a power stage. It’s got the Arduino-capable microprocessor, the high/low driver and power MOSFETs. All in one board.


My previous reply didn’t show up for some reason. I replied by email and I must have been dropped or something.

Are you sure the Lepton supports all the features listed, like missed step detection and sensorless drive functionality? IIRC it doesn’t do sensorless yet. Maybe I could dispense with sensorless.

I think it would be good to have a single board which also had a magnetic angle sensor chip on the bottom. Less expensive, no connectors, simpler more compact system.

I came to post the following, though. This is basically exactly what I was talking about doing, but these guys are charging $56 CAD when the parts are like $15 CAD. It would probably be exactly what I need, but it was nearly impossible to find, and they are charging too much. If they wouldn’t charge so much it would be perfect. I could pay $25 CAD for it maybe, and that would be viable.

for posterity, it saysthe board is a simplefoc NANO and was developed by these guys : I recognize the motor they are using, it is the one I mentioned in a different thread as having particularly low cogging.

Maybe I can just modify their design, if it is open source that should be doable. Except it’s all in chinese.

I searched high and low, and he doesn’t publish his design anywhere, so I can’t make a fork that supports step/dir practically. He also makes it very hard to use, you have to use a usb-serial converter to upload the firmware before you can use it and so on. It’s not clear what features it supports and what features it doesn’t. I might be able to tease that info out of the design, but he has failed to post the design. Shit.

Basically he is charging too much so I can’t use his actual device, and he doesn’t publish the source so I can’t fork it or have some made myself. I remain at square one. He didn’t leave a stepping stone upon which others can build. Not good open source work.

Tried to contact him, but the only information he left for contact information is his wechat id, and wechat requires that you already know someone else using wechat in order to register and communicate with others. I literally know no one else who uses wechat. So I can’t even contact him to try to make progress.

SimpleFOC does not support sensorless in the code, so even if I make a board with the required hardware changes, you will not be able to use it.

Missed step detection is done in the software, but you must have a sensor, so that conflicts with your sensorless requirement. I’m getting a little confused here about your use case?

This board also doesn’t support sensorless, and the missed step detection must be done in software.
There is no change in cost. Actually, this board would be more expensive because double-sided SMD is more expensive than single-side. Also, angle sensors are expensive themselves.

The Mosquito board has a sensor on the back, but you need to solder it manually, or order yourself with the dual SMD feature.

The Mosquito board has better components, and costs about $12 to manufacture. The Lepton is less than $10. Just saying.

Anyway, please let us know how is your research developing.


I’m looking at using the MCF8316 chip from TI, it is available from digikey for $4.5 each, but after making the board it’s not going to be any cheaper than the Lepton, it’s just that it can do sensorless. I don’t know if it will do what I need. I tried to find a pcb to breakout the vqfn 5x7 package but there aren’t any. I would have to get a custom pcb made and either attach the chip myself, which I would need a reflow soldering station thing for probably.

Does anyone know how to get a board made with a chip from digikey where they do the soldering and stuff? Like other custom board things, but with a chip they don’t happen to have in stock. Seems like it would be a common problem.

We do this here all the time, you need to manufacture the board (assuming your board is already designed). You design the board (or have someone design it for you), then you order it at one of the PCB manufacturers, and voila! You got yourself a board.

Please refer to this thread, where I described in details how to order a PCB from China.

Also, others have worked with different fab facilities, they may be able to give you feedback.

Good luck and please let us how how it goes.


no, but you can only use the parts in their parts library. I was through this once before with jlcpcb. I asked them if I could get them to make a board using a chip that was from digikey and they said no.

There are other manufacturers we have worked with, such as PCBWAY.COM.


They will source the parts and do whatever you want. However, they are more expensive and it takes longer.

Also, recently, JLC introduced a new global parts sourcing, so things move out there.

PCB order manufacturing itself is a very specialized skill-set. You need to have done it multiple times to know what to do.


I just called JLCPCB, they told me they can SMD MCF8316 however you need to order from global sourcing and it will cost you $7 instead of $4.5

So, it’s possible to use MCF8316 however someone needs to design a board for you.


I hope I’m helping you. Reading about your effort, you really need to hire someone professional who has done this before. Else, you will go crazy and waste a lot of time and money.