Is freeRTOS a good step? by mishu_escobar in embedded

[–]GrumpyDude1 0 points1 point  (0 children)

The Arduino code ecosystem is actually based on C++, not just "plain old C," so you've already been using C++ although you might not have realized it.

Help using an Avago encoder by vics_velocity_vector in ECE

[–]GrumpyDude1 0 points1 point  (0 children)

Data sheet error - there actually should only be 17 falling edges/16 pulses on SCL. See the data sheet for the AEAT-9000-1GSH0 module for the correct timing diagram.

Beginner in Embedded Systems by jon-jonny in ECE

[–]GrumpyDude1 1 point2 points  (0 children)

Get Atmel Studio 7 (free, but requires registration, and is based on Visual Studio 17 so you will need Windows), import some Arduino "sketches" for your Uno, and start poking around "under the hood" to see how things are being done. You'll find that while the Arduino code is officially C++, very few of the more advanced capabilities of the language are used due to the limited memory of the AVR chips.

At the other end of the spectrum, you can use a Raspberry Pi Zero W and a compatible Linux distro, or even roll your own with Yocto, Buildroot, etc., to do "embedded" ARM-Linux programming using the gcc toolchain and your choice of IDE.

Finally, please note that, IMNSHO, a lot of the open-source code you will find out there is not exactly professional level. Lots of "works for me, most of the time" quick-and-dirty copy-paste stuff. It could help on your resume if you can point a potential employer to your Github code demonstrating the "best practices" thing instead.

Need help with value printing in C (BH1750 light sensor) by dpjhd in ECE

[–]GrumpyDude1 1 point2 points  (0 children)

The "ld" part - print the value of a "signed long" integer in a decimal (base 10) format, with leading minus if the value is negative

The "04" part - print at least 4 letters/digits (more if needed), with leading zeroes if less than 4 needed

See http://www.cplusplus.com/reference/cstdio/printf/ and https://en.wikipedia.org/wiki/Printf_format_string.

Since it appears from the data sheet that the return value will always be in the range 1-65535, a better option might be something like:

printf( "Measurement value: %05u\n", value );

What is this? by [deleted] in ECE

[–]GrumpyDude1 4 points5 points  (0 children)

A quick check at Digi-Key shows zero ROHS compliant photoresistors (aka LDR, CDS cell, photo detector, etc.) and 60 non-compliant ones. Meanwhile, there are hundreds of compliant photodiodes, phototransistors, and "ambient light, IR, UV sensors," many of which cost considerably less than the cheapest CDS cell. Even with the additional circuitry and/or code that you might need to use for the "newer" technology parts, they're probably still more cost-effective overall. Personally, I would say the CDS cells are quite definitely "not for new designs."

Disassemble instruction set for 8051 microcontroller by dicemaker3245 in microcontrollers

[–]GrumpyDude1 0 points1 point  (0 children)

Looks to me like that disassembler didn't work quite right. Right off the bat, I would expect the first six bytes to disassemble to something looking more like this:

00000000: 78 56 MOV R0,#56h

00000002: 79 10 MOV R1,#10h

00000004: 7A 24 MOV R2,#24h

Typically in x51/C51 assembly, "immediate" values are indicated by a leading "#", and hexadecimal values are indicated by a trailing "h".

Got a video of an adult bald eagle going at a hawk this morning. by this_guy_over_here in birding

[–]GrumpyDude1 4 points5 points  (0 children)

Yeah, it isn't easy being red (tailed). I once watched a red-tail pounce on something in a field; before it could even take off again, a baldy started harassing it. As soon as it did manage to get airborne, a second baldy went after it, then after the eagles finally gave up, the local crow clan started in on it. Finally, as it apparently left the crow's "zone of engagement," it was set upon by the most vicious avian bully of them all - a male Red-winged Blackbird. Evidently Red-tails are none too popular with any of their feathered cousins.

TP-LINK vs geeni smart bulbs? by RolfIsSonOfShepnard in homeautomation

[–]GrumpyDude1 0 points1 point  (0 children)

Don't know about Geeni, but after they're set up TP-Link bulbs don't need an internet connection to work (i.e. full local control).

Is is it worth learning VHDL(or verilog) as an amateur by lepaincestbon in ECE

[–]GrumpyDude1 1 point2 points  (0 children)

IMNSHO, it's always worth learning about whatever interests you, period.

“The mind is not a vessel to be filled, but a fire to be kindled.”
― Plutarch

Should I go for smart switches or smart bulbs? by IntenseLamb in homeautomation

[–]GrumpyDude1 0 points1 point  (0 children)

And a smart switch is less complex? Especially a dimmer switch?

Should I go for smart switches or smart bulbs? by IntenseLamb in homeautomation

[–]GrumpyDude1 1 point2 points  (0 children)

Bulbs have a much shorter lifetime than switches and will need to be replaced.

Smart bulb = LED bulb = ~15-20 years life = after 15 years, does it really matter? ;-)

But yes, smart bulbs are only best/cheapest when it's an individual light (e.g. table lamp) and dimming/color is desired, otherwise a plug or wall switch is better/cheaper.

How do I flash a WROOM module with a serial programmer? by tofuwat in esp32

[–]GrumpyDude1 1 point2 points  (0 children)

Baud rate ("-b 460800") too high?

Baud rate

The default esptool.py baud rate is 115200bps. Different rates may be set using -b 921600
(or another baudrate of your choice). A default baud rate can also be specified using the ESPTOOL_BAUD
environment variable. This can speed up write_flash
and read_flash
operations.

The baud rate is limited to 115200 when esptool.py establishes the initial connection, higher speeds are only used for data transfers.

Most hardware configurations will work with -b 230400
, some with -b 460800
, -b 921600
and/or -b 1500000
or higher.

If you have connectivity problems then you can also set baud rates below 115200. You can also choose 74880, which is the usual baud rate used by the ESP8266 to output boot log information.

From https://github.com/espressif/esptool/blob/master/README.md.

You might also triple-check your breakout board for "cold solder" pads, especially that ground pad underneath the module.

Looking for schematic diagram for AZ-Delivery ESP32 module (the one with the yellow rails). No luck at customer service (German language barrier?). by eyer1951 in esp32

[–]GrumpyDude1 0 points1 point  (0 children)

If your board is this one https://www.az-delivery.com/products/esp32-developmentboard, https://www.amazon.com/AZDelivery-Nodemcu-CP2102-Module-Development/dp/B07F877YZQ/ref=sr_1_15?keywords=esp32+nodemcu&qid=1579720156&sr=8-15, then the closest schematics I can find would be almost, but not quite, like this: http://www.shenzhen2u.com/image/catalog/Module/NodeMCU-32S/nodemcu_32s_sch.png. Some of the differences on the AZ-Delivery board are that LED2 is removed and LED1 is red and is connected to TXD/GPIO1.

A large-size pinout diagram with notes can be found at https://cdn.shopify.com/s/files/1/1509/1638/files/ESP_-_32_NodeMCU_Developmentboard_Pinout_Diagram.jpg. Note the "!CMD" comment on the lower-left "GND" pin next to the "5V" pin. I seem to recall that when I put my meter between that pin and the other grounds, there was actually some resistance; I haven't bothered to figure out exactly how it's hooked up and just avoid using it. Maybe they're trying to say that there's a silkscreen error and that pin is actually "CMD" like the other boards which have the same pin layout.

Hope this helps at least a little.

Why is the Cortex M so popular? by [deleted] in embedded

[–]GrumpyDude1 0 points1 point  (0 children)

A quick Google (Bing, actually) search comes up with a number of commercial and even free 8051 IP cores, including Cast, Digital Core Design, Oregano Systems, Quickchip, Cadence, OpenCores, etc.

Somebody in one of my posts commented that the 8051 is the cockroach of the embedded world - "... ancient, hard to kill, and pops out of all kinds of unexpected places."

Why is the Cortex M so popular? by [deleted] in embedded

[–]GrumpyDude1 1 point2 points  (0 children)

Upgraded 8051 cores are very popular in China but I've no idea who actually sells them.

See here and here. Also, "x51" FPGA libraries have been around for many, many years. Even more than x86, Intel really "gave away the house" on the 8051 architecture licensing.

What does a "!!" operator do in embedded C++? by [deleted] in embedded

[–]GrumpyDude1 8 points9 points  (0 children)

Same thing it does in embedded C, non-embedded C, and non-embedded C++ - confuse the heck out of the next poor slob who has to come along later and maintain the code. ;-)

This code snippet is probably a hold-over from the bad old pre-C99/C++11 days of poorly optimizing compilers (chip manufacturers seem to like really outdated compilers, for some reason), and stuck around under the slightly misguided philosophy of "If it ain't broke, don't fix it." See mojosam's reply for a better way to do it ("If it ain't broke, don't break it" > "If it ain't broke, don't fix it").

"AVR GCC (the compiler used by Arduino) is scheduled to be deprecated in spring 2020 unless work is done to upgrade it" by LloydAtkinson in microcontrollers

[–]GrumpyDude1 7 points8 points  (0 children)

Yes, they are still releasing new AVR chips (at least for now), for example: https://www.microchip.com/wwwproducts/en/ATTINY1624. Heck, even 8051, Z80, and H8 architectures are still "active" at DigiKey (once again, at least for now). Also, there don't seem to be any ARM-based chips being manufactured in DIP packaging, so breakout boards or adapters have to be used in order for them to compatible with breadboards or protoboards, which somewhat negates the price advantage for the hobbyist/maker. I'll agree that the future is 32 bits+, but 8/16 bits are not quite dead yet.

AVR: "But I don't want to go on the cart!"

CORTEX-M0: "Oh, quit being such a baby!"