Friday, August 12, 2022

Use of Macros

I am listing some unique macros:

1. Following macros used for incrementing/decrementing any numer(integer preferred) x. This usually can be used when you are having Menu layout using pushbuttons. For each pushbutton, menu index value x can be increased/decreased by any value inc/dec and can be set to a limit max/min

#define INC(x,max,inc) x = (x<=(max - inc))?(x+inc):max
#define DEC(x,min,dec) x = (x>=(min + dec))?(x-dec):min


2. When using RTOS you have periodic tasks that may loop in every 10ms or 50ms etc. Usually while development, we want to constantly change this loop time and test functions out. But while changing this many variables that are dependent on the task time need to be varied. Following macros can be used appropriately adjust the values depending on task time.

#define TASK2_REPEAT_MS        20
#define COUNT_1SEC_TASK2    (1000/TASK2_REPEAT_MS)


example usage

Lets say you have task that repeats every 20ms. and there is a variable that checks for 1sec loop.

 

your caode can be written using above macros:

task2(){

 uint8_t var_u81secCounter;

 var_u81secCounter++;

if(var_u81secCounter > COUNT_1SEC_TASK2    ) {

/* do things whatever you want to do every 1second

}


} 


THis way if you change task periodicity to 50ms, all you need to update is macro TASK2_REPEAT_MS       50. Nothing else






Thursday, August 4, 2022

ESP32 Development

1. In the field of IoT ESP32 is major player. There are many Arduino versions are available, however they are only limited to small projects and hobby projects. If you want to develop a professional application, then you need to learn about ESP-IDF. This is the framework specially developed for ESP32 using which we can quickly drive various peripherals.

2. In addition ESP Also provides eclipse based IDE to make things even easier for developers:

3. Find the ESP-IDE here : https://dl.espressif.com/dl/esp-idf/


 

4. Select 2nd option as offline installer gives you reference that you have v2.5.0 version of IDE & ESP-IDF Version v4.4.

 5.  Git link - https://github.com/espressif/idf-installer

6

 

Thursday, July 21, 2022

Mice Puzzle

 I saw this on a forum. Solution is amazing:


Here is the problem:

Problem. You have mice, and bottles, exactly one of which is poisoned. Each mouse can taste any combination of bottles at once, and if it is poisoned it will die after exactly one minute. Once a mouse is dead, it can't taste any more bottles. How many minutes do you need to determine exactly which bottle is poisoned?

Saturday, September 19, 2020

Electronic Components Stores Online for Professionals/Hobbyist in India

Online stores

Many are working from home these covid days. Small business still need to procure items from city. If you are away from city, still you want to continue developing your products, online stores come to your rescue. We cannot appreciate enough these covid-warriors who are helping us in many ways. 

Recently many online electronic stores have opened that let you even order a single resistor. Many stores are unheard of and you do not know if you should buy or not. I recently ordered from 4 electronic components stores and I am rating my experience:

 

ElectronComponents

·       Rating: ***

·       Delivery Time: Shipped within 1 or 2 Days

·       Customer Query response : Average

·       Quality Components : GOOD

·       Contact Details:

·       Website : https://www.electroncomponents.com/

·       Free Shipping : For Orders above Rs1000

·       COD available : NO

·       I had ordered components worth 2000 bucks and it was shipped within a day. I didn’t have to contact them but other customer reviews show that they had trouble addressing their queries as they didn’t respond quickly.

·       But no customer had to face delay in shipping for any of orders. It seems “What you see is What they have”

SharviElectronics

·       Rating: ***

·       Delivery Time: Shipped within 2days

·       Customer Query response: Very Good

·       Quality Components: GOOD

·       Contact Details:

·       Website: https://sharvielectronics.com/

·       Free Shipping: No, Shipping charge calculated based on your location.

·       I had ordered 2 controllers. I got to know 2-day later this was not available with them. I was informed on Whatsapp and I could send them alternative IC numbers which they shipped.

·       The good thing is, communication was proper. We can understand in this covid situation, procurement of some items are difficult. But communicating with customer about the same is also important.

·       So I recommend this store.

 

ElectronicsComp

·       Rating: *

·       Delivery Time: Shipped after 13 Days for me, after multiple follow-ups

·       Customer Query response: BAD

·       Quality Components: GOOD

·       Contact Details:

·       Website : https://www.electronicscomp.com/

·       Free Shipping : For Orders above Rs999

·       I had ordered components worth 3000 bucks. I had bad experience as they did not have the product I ordered in website.

·       I even thought of lodging complaint against this website, just before which they initiated refund for the same. Rest of the products that I received were good quality and packaging was decent.

·       Have a look at their shipping/return policy. No sane person would like to order from this website if he knew the order might even get shipped via IndiaPost, trust me, it might take months to reach you:

·       Better choice to go for COD if you are ordering from this website:

·        In my experience contacting them was difficult, try for yourself.

 

Apart from these stores, there are Robu.in, Mouser, Digikey etc. who are more advanced in business, but no one provide small components.

Leave comment for any other new online store you came across, I will be happy to try.