-
-
So, I got this all working, including adjusting the speed with PWM. I used a 5V/500mah power supply. So far so good.
For a different iteration of the project, I needed to change the motor out and use this one: https://www.adafruit.com/products/1150. This motor is 12v and uses 200-300ma of current.
A few other components in the project require a lot of power, so my power supply is 12v/5 amps.
Here's the problem. With everything wired exactly as indicated above, it doesn't work very well with the new motor. It's set up so that when I press a button on the Espruino, an LED is lit and the motor is turned on (via PWM on the pin attached to the mosfet's gate). Instead of nice smooth motor power, the motor is very choppy and the LED starts blinking off and on in sync with the motor cutting out. It's almost as if there's not enough power for both the Espruino and the motor. But, the power supply is 5A and I disconnected everything else, so that's ridiculous.
I've tried various PWM duty cycles and frequencies and I can't seem to smooth out the motor.
What am I doing wrong?
-
-
Pat, not sure if you're still working on this, but this iOS sample code worked for me:
http://www.jnhuamao.cn/download_rom_en.asp?id=66 -> "4.0 BLE IOS7 Source code"
If the link dies, you might be able to google "huamao technology ble ios7 source code".
Once you get the code running on your iPhone (it doesn't seem to work in the simulator), you can see the HM-10 in the list, click it, and there's a text box to send text back and forth to Espruino.
There's some sample code here that is a great starting point for the Espruino side: http://www.espruino.com/USART
-
I never could get that HM-10 module working, so I replaced it with a new one which worked great on the first try. Oh well. I've gotten a few parts now that are just simply DOA.
Anyway, next question. When Espruino is plugged in and powered by the computer's USB, I can successfully connect to and communicate back and forth between the Espruino and my iPhone across bluetooth. Based on the tutorial I used (http://www.espruino.com/Bluetooth+BLE), I've been reading from and writing to Serial1.
The problem is when I disconnect from the computer and power Espruino from the wall. I can successfully connect to it from the iPhone over bluetooth (I know this because the blinking status LED on pin 24 goes to solid on), but there's no communication going back and forth.
What is happening?
Thanks!
-
@DrAzzy a tutorial would be awesome. I know you gave me some tips about driving a motor in another thread, but I just don't have enough background to feel confident about wiring it up and troubleshooting it when (inevitably) it doesn't work. I have a buddy who's an electrical engineer, I may enlist his help.
Quick update, I got my new relay from overseas and it works fine. The problem now is that when the system runs for a few hours and the voltage in the battery pack drops a bit, as soon as the relay closes and the lamp comes on, the Espruino goes dark and everything shuts off. So, for now, I'm going to try to use two separate dedicated power sources - one for the Espruino and one for the lamp. That seems easiest.
Thanks @Stuart.d.d and @user7143 for your tips as well.
-
-
So, I seem to be having a lot more trouble than I expected getting my relay module to function properly at very low temperatures. I think I actually broke one - it's suddenly very loud when it closes and no longer works reliably at 6v DC. I'm currently waiting for a new one to arrive from overseas.
When reading my Mimms book on intro electronics (highly recommended), I came across a thing called a Thyristor Silicon Controller Rectifier. It's this: http://www.radio-electronics.com/info/data/semicond/thyristor/thyristor.php
It looks like it's a lot smaller than a relay module, works with about the same voltages, is instant, and cheaper on ebay. It seems like it should work great (I'm implementing this project: http://www.espruino.com/Heater+Controller).
There has to be a good reason why it's not being used by everyone instead of a electromechanical relay. Any ideas?
-
@DrAzzy re: "Alternately, wait, how do you have it wired?" That's another weird thing that probably needs it's own thread. I have a JST-PH-2 connector, and it's spliced directly into the power supply (the 5V output from the regulator). But, plugging it into the actual JST-PH-2 female socket on the board does NOT power up the Espruino - it stays dark. Plugging the exact same connector onto some pin headers for BAT and GND DO power up the Espruino tho, so that's what I'm using. So, something's not right I think. 5V power via the USB connector works fine.
I have a couple of these guys: http://www.espruino.com/ULN2003 I'm going to drive a single motor with it for this same project. I'm using a common ground. Maybe I could also use the ULN2003 for this?
-
@tage @DrAzzy : Quick update, I sacrificed a car USB adapter and successfully made the voltage regulator. Also I made a DIY 4-AA cell battery pack and put it in series with another one, successfully yielding 12 volts input --> 5 volts output.
It powered the board ok, but when the relay triggers the load, the Espriuno goes dark and resets. My feeling is there isn't enough amps to power everything (I'm basically doing this: http://www.espruino.com/Heater+Controller).
Assuming I'm right, I probably need to dig deeper into making a custom voltage regulator myself with sufficient capacity for the amps I need (of which I have no idea! Just... "more").
@StuntMonkeh hmmmm... what are these alternative relays you speak off? Maybe those would make my life easier.
-
Wow, these are some great answers. @tage, that didn't even occur to me, but I think I can do that tonight without having to order anything from overseas. Awesome. @DrAzzy, I feel like I should copy/paste your answer into the Espruino docs. :) @user7143, the load is DC, and the battery powers everything: the load and the Espruino.
-
My project requires controlling a relay module from Espruino, and to be powered by batteries in cold temperatures. At room temperatures, so far everything works great by connecting 4 AA cells (about 6 volts) to the Espruino. The relay comes on fine. However, at cold temperatures (< 0 degrees C), the voltage in the battery pack drops to around 4 volts. This is not enough to flip the relay and power the board and the connected items. (I tried alkalines and lithiums - lithiums hold out a bit longer but eventually succumb to same problem).
I tried using a 9 volt battery, but this is TOO much for the relay module, and it just stays on.
My next thought is to use a voltage regulator, and run 6-8 cells (9 volts or 12 volts) on the battery pack. This way, the Espruino would get a steady 5v no matter what wide variances in voltage come from the battery pack.
Then I thought something from these guys (http://www.digikey.com/product-highlights/us/en/cui-v78-regulators/1177) would do the trick. Something like the V78-500-SMT: http://www.cui.com/product/resource/v78-500-smt.pdf
So:
- Is this the right approach?
- Would the linked component work, presuming I add on those capacitors mentioned in the "TYPICAL APPLICATION CIRCUIT" section?
- Is there some module that is ready made (e.g. no assembling a bunch of capacitors) that would be better suited to the task?
Thanks!
- Is this the right approach?
-
DrAzzy, I too thought a small page that functioned as an electronics basics primer would be most helpful. Since I'm a newbie, I didn't know what I didn't know until I started doing stuff, and realized that there was a huge amount of knowledge and equipment that I needed in order to get anything accomplished.
I took a first pass at a primer for as a page for this site, and will do a pull request in the next day or two to see if anyone has any opinions on it's value.
-
Hi Gordon, I'm on OSX so I can't really use the instructions at the end of the "Building" section of the README.md. I'm a nodejs developer by profession so I have just about everything else required (I presume) except for what looks like a custom script to build the HTML from github.
I'm making a sort of "Espruino for Dummies" page with helpful info about what people should learn as background and what tools to have on hand when beginning with Espruino development. I want to make sure the links work as expected before I do a pull request.
How can I obtain the custom build script and execute it on OSX? I'd be happy to update the README with the instructions as well.
Thanks.
JB
-
-
I soldered the HM-10 module to the Espruino according to this page: http://www.espruino.com/Bluetooth+BLE
Actually I was switching back and forth between that page and the HM-05 page, and ended up accidentally soldering pin 34 as well. Then, trying to get the solder off, I soldered 33 too. I gave up at that point so those 2 pins are also currently soldered.I do NOT have pin 24 soldered (yet). That seems to be optional?
Anyway, I plugged the Espruino in to my Mac via the USB cable and... I'm not sure what to do next. The AT commands:
"Serial1.on('data', function (data) {console.log(data);});
Serial1.print("AT")"Just return "Undefined". No other output.
Questions:
Where does power for the HM-10 come from? Is it just taken for granted that the user knows to hook some power up somewhere?
Assuming there's power going to the HM-10 board from Espruino somehow: the HC-05 tutorial says "Simply pair with this module and enter the pairing code 1234.". Does that mean connect with my Mac's bluetooth capability? It's not appearing in the bluetooth list. I also tried with my iPhone 4s, it's not in that list either.
Also on the HC-05 page, it says "Note: If you power the board from your PC's USB port, it will move the console to USB and you will get no response from the Bluetooth connection." So I tried just using a USB wall plug, but still the bluetooth connection isn't showing up on Mac or iPhone.
I have pin 23 just soldered down to Espruino. I'm not sure what is happening in the picture on the HM-10 page with pin 23, it looks like a big blob of solder. And this makes it seem like it's optional, just for configuration: "In order to use pin 23, connect this pin via a switch to ground (defaul position of the switch is open). Also connect this pin via a resistor of 1k to 3.3V." If I do need to do something with this pin, do I really add the stuff to BOTH the ground and 3.3V?
What are my next steps for troubleshooting this?
Thanks.
-
-
-
-
-
I’m trying to follow the tutorial here (http://www.espruino.com/Heater+Controller), as it does exactly what I need. However, I need to run this off a battery pack rather than a 5V DC wall adapter.
My first thought was to use a battery pack of 4 AA batteries, generating 6V.
As I learned in another thread, apparently diodes can be used to knock down voltage. I presume one of those will come into play.
How can I adapt the tutorial to use a 6V power supply rather than a 5V?
Thanks.
-
-
I added some labels to the diagram. Here are my guesses as to what solders to what for 1-7:
- Non-band side of diode - not sure where this goes
- Band side of diode - solder to the positive side of the motor (3)
- Wire to the positive side of the main 3.7v power source. You mention another diode tho?
- Use wire to connect to any pin in "General purpose IO Pin" section here: http://www.espruino.com/EspruinoBoard
- Drain - connect to 7
- Source - use a wire to connect to the board's "GND" terminal.
- Negative side of motor - connect to 5 (drain)
Except for #1, does that look right?
- Non-band side of diode - not sure where this goes
-
So, probably my two best options are:
Option 1. Go with the ULN2003 and follow these instructions: http://www.espruino.com/ULN2003
It seems reasonably straightforward. The + / - wires on the motor seem to go in the pink area of that diagram. Although, I have no idea what this part means:
"Note: COM is connected to each output (1-7 C) via a diode. If you're driving inductive loads then you can connect it to the other side of the load being driven, and it will help to clamp the Back EMF generated when the load is turned off. For instance if you are powering your load from BAT, just connect COM to that."
Option 2. Use one of the MOSFET thingys. Is there a tutorial somewhere that shows what to solder to what, including where the motor wires go?
Thanks!
I did NOT remember the diode. I will add it.
What size capacitor? And in general, how would I calculate what type of capacitor I need?
Thanks!