A New Tiny ML Invention

Hi everyone,

I posted previously about a Tiny ML project I was going to make into a business. This was about a machine learning keyboard powered by Tiny ML. I decided to go a different direction and am keeping my current project under wraps. Also, speaking along those lines, I’ve found out something that could be beneficial to potential inventors. You can make a public declaration of a project or start selling it publicly, and it is technically protected for 12 months without patent. You can also file a cheaper provisional patent with the uspto.gov, if you reside in the United States. Anyway, I told Vijay that I would do a custom ML model for the class. I have planned it to be a public release of my new invention as well as a demonstration, and morale boost to all of us that participated in the class. You see, I am trying to run some DC motors when the arduino nano hears some certain words. I already trained a custom model with two words, and I know it works on at least one of them. However, I have run into a problem not with Tiny ML, but with the output voltage of the Arduino. The Arduino nano 33 BLE sense appears to output about 3.3 volts according to my multimeter. This isn’t enough to power a DC motor, and if it is connected via USB to computer, it could actually damage the computer or Arduino from drawing to much current FYI. A solution to this is to use a logic-level mosfet, which is a type of transistor that will switch on and allow current to flow based on the output signal from the Arduino. While this might be a viable solution if I were using an Arduino UNO, which apparently outputs 5v, the output of the Arduino nano 33 BLE Sense is not enough to fully switch on or (open up) the mosfet. Even this logic level mosfet requires 5v applied to the gate to allow all the energy fully to flow. These 1.5-5v DC motors I got work pretty well, and I have got the circuit to work for about a minute, but the BJT transistor overheated. The DC motors can draw up to 5 amps when stalled, so from a 5 volt source require virtually no resistance. My main problem is that even if I overcome the problem of getting the mosfet to switch fully on (it does a have a heatsink to dissipate heat) I still run the risk of it getting to hot. Using any intermediary to switch on the motor seems to run the risk of getting to hot. From what I read on wikipedia, the temperature at the junctions of the mosfet are about 70 degrees per amp. Putting the mosfet at hundreds of degrees at 5 amps. Luckily I paused my interest in this project before I literally had a meltdown! I know a little about electronics but I’m not a mathematician. Someone please help me.

3 Likes

Hi @Xen ,

I am not sure sure about the availability at your locations but there are different motor drivers that we use depending on the current requirements of the motor. You can have a look at something similar to these : -

  1. L293D data sheet, product information and support | TI.com
  2. L298N
  3. BTS7960

Alright this reaffirms my thoughts on whether a motor driver would be correct in this instance. Thank you so much Daniel. I will look into getting one.

Ah, I see it now. A motor driver is basically an H-bridge, which is an electrical version of a relay. I made an H-bridge several years ago using BJT transistors. Very interesting. I think I can build it up, but I need to perform some math to see if it will all work out. I already have some multiple mosfets. I just don’t want them to overheat.
bcea561601e37f6947000e129702696109b1d1ca

1 Like

Hi Xen,

I know your problem. When it comes to buying sensors/actuators for Arduino or other microcontrollers it is usually a hassle.

For your problem there is actually a very elegant and easy-to-use solution: a buck boost converter.

I use specifically this one: s9v11f5 buck boost converter

This little device guarantees a constant 5V output regardless of what input you give it (within its limits of course). So, you could either give it 3V or 9V and it would always transform it to 5V.

Besides, I strongly encourage you to watch this video.

There you will see how he goes on various ways of solving your problem (including the solution a recommended you) and explains how to set them up.

I hope this helps.

2 Likes

This did help me Chaplin. I have been considering using a boost converter. I’ll probably use a store-purchased boost converter in the final design of my circuit. The H-bridge seems to work if I need to reverse the motor either forward or backwards. But there still seemed to be a problem of getting enough current and volts to the motor. I think a boost converter will work well for this. But for my temporary demonstration needs I’m going to try to use one mosfet, which does output the right voltage at 5-6v. To power three other mosfets hooked up in parallel to fully open them. Since the mosfets will be connected in parallel it should distribute the current put through them, hopefully lowering any temperature gains for each one to around 106 degrees Fahrenheit even at 5 amps. I had the idea of using one mosfet as a boost converter to activate other mosfets when looking at the schematic of an H-bridge. I have already purchased some mosfets so I might as well go ahead and attempt to use them. It would be impractical in the final design to use 4 mosfets * however many motors I need, so I will probably just use a boost converter. From what I’ve read mosfets don’t dissipate much heat when fully turned on, but with my invention they could be turning on and off a lot, which would generate significant heat.

1 Like

correction should be celsius instead of degrees.

An H-bridge should actually work in this situation, the nature of which is to basically create a short from the main power source(in this case 6 volts) to the DC motor. I originally thought it was only used for switching the rotation of the motor shaft. Upon further inspection I found out the underlying nature of an H-bridge.

Hopefully this will help someone.

1 Like

image
Couldn’t you just run the output through a 1k and into a basic transistor whose collector is connected to 5v through a 330 resistor. that would give you enough current to drive one of those $2.00 blue relays.

Hey thanks mcktimo for the response,

I actually hadn’t thought of using a BJT transistor. I found two relays after I purchased the mosfets. That actually could work. I’ll try it this evening.

Mcktimo,

The other problem I have, is that I already have two relays. They are NAIS DS2E-SL2-DC5V and the datasheet I found was for a panasonic brand with the same model data. It says on the datasheet that they only require 36 millivolts to power on. The coil supposedly has 139 ohms of resistance. With my voltage over current times resistance, I calculated the required milliamps to be about 30 mA. However they don’t seem to switch on at that amount. From what I can recall, using the mosfet gave me about 30 mA and connected to the relay it still wouldn’t work. I don’t know in this case if it is a matter of having enough current to have 30 milliamps after taking into account the resistance of the relay coil. I got it to work by plugging it directly in with a 6v power source. I could hear it switching on. 6v / 139ohms is = ~43 mA. What do you guys think about this. This is a problem that has been perplexing me for a while.

I can verify the relay does work when connected directly to 6v. I tested the continuity of the switching contacts. I just don’t want to overpower it. The voltage can be significantly above the nominal 5v. I’m just concerned about giving it too much current. I tried using a potentiometer to find the sweet spot of the relay’s current, but to no avail. I may have had the pot connected incorrectly, though. I haven’t done electronics for some time.

Maybe just pick up a couple of https://www.amazon.com/HiLetgo-Channel-optocoupler-Support-Trigger/dp/B00LW15A4W/ref=mp_s_a_1_3?dchild=1&keywords=5v+relay&qid=1621544228&sprefix=5v&sr=8-3. They need maybe 15 MA to fire. 5v/330ohms.

I am curious if @jesmith or @brownby have any thoughts on this. They are the electronic wizards in our Harvard labs.

1 Like

@Xen I’ve read through this thread to try to catch up and chime in some some potential help, but it isn’t clear from what’s posted here what your latest schematic might look like or a related list of issues.

One thing I will emphasize as a general premise here is that you want to create some separation between control signals and power delivery in introducing a secondary supply (with shared reference) specifically for the motors. Its voltage and current ratings can then determine the motor response via a transistor interface (which can be either discrete or integrated, as some have suggested) with control signals stemming from the Nano. Depending on the driver / circuit design, you may want to level shift the control logic from 3.3V to 5V.

Hi jesmith,

I know it is usually customary to have a schematic or circuit design. I have just been going through others input and trying different things. One person suggested an optocoupler type device. I think that may work. I just need to find some way of switching a small voltage and current to a relatively larger one. Originally I was just going to use some old electronics I had lying around. I actually have a photo resistor and some LEDs. However, if I made an optocoupler from those components the resistance on the isolated part of the circuit on the photo resistor would still be too much to power the DC motor. Then I was also thinking about doing something called bootstrapping with a mosfet’s source tied to a positive voltage and somehow raise the input signal to be higher, so that I could fully “turn on” the mosfet. Bootsrapping isn’t easy for me though, as I’m not good with the math required to use capacitors and resistors in complex ways. I think I will buy the optocoupler when I get some extra money.

Thank you all for your help, it is greatly appreciated.

@Xen Working from this premise and noting that you’ve mentioned motors with a 5V rating, I can’t imagine you’d need an optocoupler, which is typically called on to isolate power systems either for safety in, say, medical instrumentation, or in driving high voltage loads, which 5V is not :slight_smile:

Here is an approach that leverages BJTs upstream of the FETs you’ve discussed in the H-bridge topology to address the 3.3V level:

To break down how it works, take a look at control signal A. If this is 3.3V and R11 and R13 are sufficiently small (a few hundred ohms, say), then Q11 and Q13 are going to be saturated so that their collectors are effectively at ground (or close enough for approximation). For Q7 (a p-channel FET), this mean it’s conduction channel will be fully enhanced whereas Q9 will be “off.” If control signal A is low, Q11 and Q13 are cutoff, and their collectors are pulled to the high-side rail by R7 and R15, so that Q9 is fully on and Q7 is off.

Similarly for the other side.

If you don’t need the motor to switch directions, this can be reduced to, say R13, R15, Q13, and Q9 with the motor as a load north of the FET Q9.

Hope this helps.

Also, to avoid overheating:

Check your FET power ratings and Rds_on values (smaller is better) to calculate power (P = IV = I^2xR) dissipation requirements against whatever package / heatsink.

The rds_on is rDS(ON) = 0.047Ω for the mosfet I have. I like the idea. I am just concerned that using the transistor I have might be less than is enough to fully turn on the mosfet. I know that there is usually a voltage drop of about .6 volts on the emitter of the transistor. I have several 2N222 BJT transistors. The source voltage for the circuit I am trying to build is with four AA cells. So that’s like ~6.2-~6.3 volts. I am also not sure how to read the other transistor markings to actually identify the correct datasheet. The H-bridge idea seems good to me. I do not need the motor to turn in different directions, so just a partial H-bridge would hopefully work. I guess, 6.2v-.6v = 5.6v, so it would still hopefully turn fully on. I have learned online that when a mosfet is turned fully on it dissipates very little heat, I still worry though, because if for some reason the motor were stalled(say a kid was holding the shaft) it might then overheat at 5 amps of current draw. There are also the times when the motor is just turned on or off where the resistance might be higher, and if ran multiple times in a row might overheat. But I will try to use the BJT transistor on the mosfet either later tonight or tomorrow. Thank you for your help jesmith.

I discovered the mosfets I have are all logic level, so they should turn fully on at 5v.