Hot answers tagged

22

Here's a slightly different approach in stead of a Lua vs. Python shootout: Six of the most popular ESP8266 "runtimes": AT Command SET. Popular when the 8266 is paired with another MCU. Communicates via the serial port. ~64k of 128k RAM available. MicroPython. A MicroPython script interpreter with user friendly GUI that can be accessed via the serial ...


7

Not sure if this is your problem, but setPinValues looks weird to me: void setPinValues(String message) { for(int i = 1; i <= sizeof(pins) / sizeof(pins[0]); i++ ) { String pinNumber = String(i); if( message == pinNumber + "H\n" ) { pinValues[i] = HIGH; } if( message == pinNumber + "L\n" ) { pinValues[i] = LOW; } } } ...


7

I love Python. Most of the programs I write for my own use on my PC at home are written in Python. That said, I don't use Python in my microcontroller based projects. Python is intended for use where you have memory and processor horsepower behind it. It dynamically allocates memory, and takes care of cleaning up objects your program doesn't need ...


6

I'm sorry to necromance, but you can run LTspice with: scad3.exe -ascii -b netlist.net And it'll give you an ascii file output. You can combine this with the .save directive to get convenient output.


6

I don't think you really understand what you are talking about here. "Zigbee", or IEEE 802.15.4, is a protocol. As such, it has no "programming language". Theoretically, it's completely possible to implement a system which can handle the zigbee protocol in any programming language, assuming that whatever language you're using has adequate hardware support ...


6

I was having a similar problem with a Wemos D1 mini board. Erasing and Flashing the firmware worked. However I was getting no REPL prompt, resetting was giving me garbage. I solved it by adding "-fm dio" when writing flash. esptool.py --port /dev/ttyUSB0 --baud 460800 write_flash -fm dio --flash_size=detect 0 esp8266-20170823-v1.9.2.bin


5

According to the schematic, there is a 10k--6.8k resistor divider in the circuit. 6.8k / (6.8k + 10k) = .4047619 1/.4047619 = 2.470588 Another place to look might be: __lsb = float(0.0000078125) # default lsb value for 18 bit 7.8125e-6 * 2^18 = 2.048 // full-scale value? 5V / 2.048 = 2.441406 Or maybe some combination of those things. Sorry I don't ...


5

The answer is a guarded "Yes" : it is possible, but probably not commercially worthwhile. Hardware acceleration for OO languages was once a hot topic, but died down about 25 years ago. One project was the Linn Rekursiv. It coincided with the rapid rise of RISC hardware and didn't last long enough to see their fall back from the leading edge. Probably the ...


5

One option is to parse the string in python and then send some sort of binary format to the microcontroller. This would be more efficient bandwidth-wise and the MCU code will be much simpler. The link to the microcontroller would still be serial, but you would not be limited to sending printable characters. It's quite easy to do open a serial port with ...


5

I'd make this a comment, but I don't have enough points to do that yet. You should plot your FFT data starting at 0 Hz and go up to, say, 500 Hz. That will give you 10 or so harmonics. You are probably zoomed too far out in the frequency domain(x-axis) to get much detail and realize what's going on here. And yes, the fundamental should be at 25 Hz.


5

Your signal is a square wave with its base at 0V and its peak at 2.7V or so. So it has an average voltage of 1.35V. In the frequency domain, the overall average of a signal is its content at DC or 0Hz -- so that's why there's a peak at 0Hz. The FFT of a square wave that is centered on 0V has energy at every odd harmonic, starting at 1. So there's energy ...


5

Your original sample is too small to know if it's FLAC or not. You need a long sample, and then look for 0xff 0xf8 bytes in it to see if you have FLAC block headers. Your additional sample from the beginning of the streadm is definitely FLAC. FLAC is a complex format for compressing audio (format overview), with many variations on sample size and so on. ...


4

It's a performance issue. The first version of setPinValues() is making many calls to String() each time it is called, and this is a nontrivial function. This causes setPinValues() to take much longer than you think to finish, so it isn't too surprising that the Arduino eventually can't keep up with the incoming messages at 57600 bps. In the second version ...


4

If both share the same logic levels (0V-3.3V) and the same ground it shouldn't be a problem. But then you aren't using RS232, just UART. The Serial bridge on the Arduinos works the same way. The FTDI chip uses 0V-5V and the ATmega uses 0V-5V.


4

Plug the Leonardo in to the USB port of the Pi. Open the serial port /dev/ttyACM0 and send the data. On the Arduino receive the data through the Serial object. Alternatively, connect the Pi's TX pin to the Leonardo's RX pin, and connect the Leonardo's TX pin, through a 5V -> 3.3V level shifting circuit (there's lots of options - google them) to the Pi's ...


4

To a first approximation, frequency does not matter at all, provided it's fast enough to avoid the appearance of blinking. All that's important is the average power of the LED, which depends only on the duty cycle. In practice, there are switching losses that increase with frequency. Each transition from high to low requires some amount of energy, such as ...


4

You selected a microphone board with automatic-gain. This is exactly the OPPOSITE of what you need. You can not measure the actual audio levels when there is something upstream UN-doing all the audio level changes ("auto-gain"). So first, you must use the proper microphone module that will deliver the actual, honest, un-modified audio levels to you. ...


4

You're trying to plot in the time domain (ie. the x-axis is in seconds) but your formula is in the frequency domain (s is a complex frequency variable). You would need to perform the inverse Laplace transform to get back to the time domain. This cannot be done unless you have a s-domain expression for Vin, which is tricky given that you just created it with ...


3

I don't think you can generate a txt format directly from the ltspice command line. I recently looked into this and I came across an old discussion which includes the primary author of LTSpice and indicates (at least as of 2003) 1) you can't export text directly from the command line, 2) the binary format is intentionally "secret", 3) there is a separate ...


3

You could get a Raspberry Pi. That would simplify a lot of things that you want to achieve.


3

PySerial (and serial libraries in general) have no idea of the concept of a "line". When you port.read(), you get what is in the serial buffer right then, so if you opened the serial port when the arduino was partway through sending a serial message, you're going to get just the latter half of that message. If you call read() when the arduino has only sent ...


3

You have the wrong thing, first off The automatic gain control (AGC) on your existing microphone-board is not what you want here -- a sound level detector is going to get thrown off by the action of the AGC loop changing the gain all over the place as it tries to maintain a constant output level (what else would you expect from an AGC loop?). You might as ...


3

Use a USB to Serial Port adapter with your microcontroller.


3

I'm maybe a little too late for the party, but after reading the above, and having a similar problem I found that the package content of the LTspice app has an executable file found at: /Applications/LTspice.app/Contents/MacOS/ I am not sure how to properly work with the command line help specified in laptop2d's answer, as it seems that LTspice saves as ....


3

Your voltage is given in the time domain (voltage values as function of time \$t\$). Your low pass filter definition is given in the s-domain (transfer function as function of complex frequency \$s\$). Both defintions don't fit together well (I wonder anyhow where you got the transfer function definition of the filter from if you don't know what to do with ...


3

The next step is the trapezoidal rule; i.e., approximate the integrand with line segments between the sample points. If you draw it, you see that the correction is graphically the area of a rectangular triangle. Numerically one integration step gives an increment (delta t) x (the average of consequent samples). The next step is to use Simpson's rule. ...


3

Python has a library for nearly everything: From xkcd. It unfortunately does not include a module for "make USB do things it wasn't built to do." You can't send single pulses over USB. It isn't designed to do that. The port information you showed is about a connected device. Looks like you had an LG phone plugged in to your computer. You can get a ...


3

You can buy a USB-Serial converter with "TTL" output that should be appropriate to trigger your camera. Various modules are available, very inexpensive. Engineers and programmers frequently use them for microcontroller development, and they're used by hobbyists for modding devices as well. They usually have a standard USB-serial chip such as the Chinese ...


3

Yes, you can. There are a great number of parallels between (certain) microwave filters and (certain) optical filters based on impedance concepts. This section of a video can illustrate this: https://youtu.be/pLl3q6WKtxw?t=2346 Both optical and RF signals and filters can be modeled with complex amplitude/phase responses VS frequency, and so you can use ...


3

This is not a software issue, but a fact of data transmission. There are signal losses in wired just as in wireless signals. This is either due to the resistance/capacitance of the wire or the noise pickup from other signals. You could experiment to see what could be done to improve it: higher current through the wires, shielding/twisted pairing.


Only top voted, non community-wiki answers of a minimum length are eligible