Hi there, my name is James! For a long time I used “cmiyc.com” for my blog and personal brand. It all started back when I was a kid and used BBSes running at the blazing speed of 2400 baud. I tried starting my own board, but didn’t have a dedicated phone line. So, I called it “Catch Me If You Can” and adopted “CMiYC” as my handle.
The name “baldengineer” should be obvious I hope!
What Can You Find Here?
Electronics has been a passion since I was 12 years old. Until I went to college, I taught myself. I even made a small business out of modifying TI-85 calculators and selling TI-LInk to Parallel Port adapters. As my career has grown, so have I. Now I find that I like to teach. So I combine my two passions: Electronics and Teaching. The best example is here, a new TutorialCast I created called “AddOhms.”
Top 10 Posts
So far, readers tend to come to my blog for the following 10 posts:
- Arduino: Multitasking with millis()
- Arduino Board Comparison Chart
- Project: MSGEQ7 Simple Spectrum Analyzer
- Arduino: How do you reset millis()? (Hint, you don’t.)
- Arduino: Using the Internal Pull-Ups
- Arduino: Sending and Receiving Multi-Digit Integers (Like 100, or 1040)
- Arduino: millis() example: Police Lights
- Project: Reflow Toaster Oven
- EAGLE: Ground Plane (Polygon) Fills
- Learning: The Basics of LEDs
Other Projects
There’s been a couple of other projects I have worked on in the past.
UnitiBlue – Blackchopper
This was the first business I tried with a friend. We had an awesome product, but didn’t really know what to do with it. We created a universal USB adapter called “UnitiBlue.” You connected various adapter cables to it, which provided the means to connect old-school video controllers. The UnitiBlue emulated an USB Keyboard so that you could use NES, SNES, Genesis, and even TurboGrafix 16 controllers with emulators.
I still have a couple of units, but no longer the firmware. Since these were based on the Cypress EZ-USB 8051 chips, all of the firmware was built into the PC’s driver. Each time you connected the device, the firmware was downloaded and run. Sadly, we don’t have the firmware anymore.
MacCaching – Geocaching for the Mac
When I first got into Geocaching, there was an appalling lack of support for the Mac platform. (At the time, my PPC-G5 iMac was “the beast” machine.) So I created a software that managed Geocaches like iTunes managed songs. My creativity was at a max because I called it: MacCaching. Unfortunately, I hit a point where I lost the source code due to a failed hard drive. I haven’t had a chance to go back and recreate it from scratch. (Also, I have since started using multiple back up services.)
Hi James,
Thanks to you for providing us valuable information and practical knowledge !
In one of your video you’ve beautifully explain the myth about using p channel mosfet only need negative voltage on gate. Actually that was the between Gate and Source voltage, which was not clearly mentioned by any professor.
My question to you is, in N channel mosfet the same concept is followed on both e & d MOSFETs ?
It was a written tutorial, not a video.
I highly doubt this statement. What else would a professor talk about in regards to ANY MOSFET but the relationship between how it activates and the voltage from gate to source? It’s the most fundamental aspect of a FET. I also know it couldn’t be “any professor”, I can name the one that taught me how they operate. He is where I learned their behavior.
I don’t know what “e & d” is nor do I understand what you mean by “concept” in this context.
Thank for your reply !
In my comment “e & d” represent enhancement & depletion type of MOSFET respectively. In N channel mosfet data sheet shows positive voltage require to turn ON mosfet, so I just want to know the difference should be higher in order to turn ON N channel mosfet ? Like p channel mosfet does ?
Please reply, Thanks in Advance. 🙂
https://forum.arduino.cc/index.php?topic=552438.new#new
James, I’ve been trying to use your millis tutorial to make my project work, and not having success. I have posted all my code and comments on Arduino forum, but not getting too much success. Can you take a peek?
FYI. I left a comment on the Arduino forum.
Hi James,
Just want to say THANK YOU for all of your amazing content that you deliver.
As a small U.S. electronics manufacturer, we have started referring new customers to your website. Particularly those in new product development stages.
Though we have a small audience for our blog, we posted a blog today showcasing your work:
“James Lewis: The Bald Engineer Delivers Electrifying Information”
https://falconerelectronics.com/bald-engineer/
Thanks again! You are an outstanding resource for the electronics community.
Keep up the great work and wishing you continued success.
Sincerest regards,
The Team at Falconer Electronics
James,
sitting here on my project 12VDCC-230VAC inverter to drive the Nesspresso machine in VW-Bus. My project is to build this 1.2kW DC-AC Inverter in a automotive battery footprint.
Investigating in the measurement equipment following question raise about oscilloscppe probe
1:1, 1:10 and 1:100 what is the difference and probably can I make it DiY
Active probe versus passive probe
Differentiell probes
As work in this area it is probably a post worth
All the best to west
Axel
Hi, James
I’m an old bald bugger and first time user of arduino sketches.
I have a simple solar hot water sketch that I copied and pasted and it appears to work well.
I added serial print code to check temperatures of 2 sensors.
But the serial print stops and it seems to be caused by a WHILE construct.
I have read a lot of your articles and it appears that the WHILE construct can be substituted a Millis delay.
I am having a hard time getting my head around how to apply this.
Is there an example sketch that you could direct me to?.
Any help much appreciated.
Regards,
JohnV
Move your check and print code to a function and wrap it with a millis() check. Then sprinkle calls to the function wherever. The code will only run as fast as you set printInterval.
It would end up looking something like this (unchecked):
And then in your code you could just do:
Thanks for the quick response,but I am still having problems deciphering code,
I have included my untidy code, perhaps you could apply your code suggestions or comments to this:
Any help much appreciated.
#include //loads the more advanced math functions
const int PSENS = 1;
const int TSENS = 0;
const int R1HWE = 5; // No code to be done
const int R2PUMP = 6;
const int diffON = 8;
const int diffOFF = 3;
const int ELCONTROL = 36;//No code to be done
//int solarPanelTemperatue =0;
//int hotWaterTankTemperatue =0;
void setup(){
Serial.begin(9600);
pinMode(PSENS, INPUT);
pinMode(TSENS, INPUT);
pinMode(R1HWE, OUTPUT);
pinMode(R2PUMP, OUTPUT);
digitalWrite(R1HWE, LOW); //?
digitalWrite(R2PUMP, LOW); //?
}
//FOR TEMP
double Thermister(int RawADC) { //Function to perform the fancy math of the Steinhart-Hart equation
double Temp;
Temp = log(((10240000/RawADC) – 10000));
Temp = 1 / (0.001129148 + (0.000234125 + (0.0000000876741 * Temp * Temp ))* Temp );
Temp = Temp – 273.15; // Convert Kelvin to Celsius
//Temp = (Temp * 9.0)/ 5.0 + 32.0; // Celsius to Fahrenheit – comment out this line if you need Celsius
return Temp;
} //FOR TEMP1:
double Thermister1(int RawADC) { //Function to perform the fancy math of the Steinhart-Hart equation
double Temp1;
Temp1 = log(((10240000/RawADC) – 10000));
Temp1 = 1 / (0.001129148 + (0.000234125 + (0.0000000876741 * Temp1 * Temp1 ))* Temp1 );
Temp1 = Temp1 – 273.15; // Convert Kelvin to Celsius
//Temp = (Temp * 9.0)/ 5.0 + 32.0; // Celsius to Fahrenheit – comment out this line if you need Celsius
return Temp1;
}
void loop(){
float solarPanelTemperature = (analogRead(1));
float hotWaterTankTemperature = (analogRead(0));
if(solarPanelTemperature > (hotWaterTankTemperature + diffON))
{
digitalWrite(R2PUMP, HIGH);
do{
delay(250);
solarPanelTemperature = (analogRead(1)); //analogRead???
hotWaterTankTemperature = (analogRead(0));
}while(solarPanelTemperature > (hotWaterTankTemperature + diffOFF));
digitalWrite(R2PUMP, LOW);
}
{ //PRINT TEMP hot water temp
int val; //Create an integer variable
double temp; //Variable to hold a temperature value
val=analogRead(0); //Read the analog port 0 and store the value in val
temp=Thermister(val);//Runs the fancy math on the raw analog value
Serial.print(“Hotwatertank: “);
Serial.print (temp); //Print the value to the serial port
Serial.println(” C”);
}
delay(500);
{ //PRINT TEMP1 solar panel temp
int val1; //Create an integer variable
double temp1; //Variable to hold a temperature value
val1=analogRead(1); //Read the analog port 1 and store the value in val
temp1=Thermister(val1);//Runs the fancy math on the raw analog value
Serial.print(“Solarpanel: “);
Serial.print (temp1); //Print the value to the serial port
Serial.println(” C”);
delay( 1000); //Wait one second before we do it again
}
}//endcode
Hi,James
Still thinking about that code mod you sent.
Have I got this right? [Not in code speak]
Void checkTemp is a loop function to check the serial print ?.
In the void loop the temperature gets checked via checkTemp() then serialprints?
In the while condition[where I was having the original problem] the temperature is checked via checkTemp() and serial printed also?
What does[arduino] represent ?
Hope this makes sense, sorry if these are dumb questions,but its a learning curve for me.
Regards,
JohnV
Sorry, but this is the beyond the level of help I can provide. I suggest you post your project on the arduino.cc forums, so you can get more help.
James, I have a problem with Arduino code. I have searched far and wide, just can’t seem to find anything. I am turning on an LED when the switch is open. I want it to flash for about 200 milliseconds then turn off while the switch is still open, then wait for the next cycle. So essentially the LED will act like a camera flash. I have tried the examples in Arduino and searched the Arduino board. I am running the arduino through a Mosfet and turning on the LED with a 12v power source. I know there has to be some code that (1) turns on the LED when the switch is normally open (2) turns off the LED after 200 milliseconds (or whatever I choose) while the switch is still open (3) keeps the LED off until the switch is opened again. The cycle repeats.
You need to use millis() and build a simple state machine. Similar to this example: https://www.baldengineer.com/use-millis-with-buttons-to-delay-events.html
Thanks. Just what I was looking for. YOU’RE A GENIUS. None of the guys on the other boards could help. I do have a follow up. I would like to run a 12vdc LED 10watt through a transistor which is to be controlled by the Arduino. Do you have a diagram as to how to hook something like that up. I wasn’t sure which pin would be best. I was thinking of using a Mosfet NPN (IRF540N) for the transistor (which needs 2-6vdc to operate) and toggling it off and on. I would hook up the LED to a 12vdc power supply on the collector, the gate to the arduino and the emitter to ground. Any Mosfet that you would recommend. Thanks for reading.
This tutorial might help: Delayed events with millis
Easy, lucid and really great videos. Wonder if you can help me in making videos for junior science students in my language, Gujarati. What are the software / hardware tools you use to make your videos so neat and direct without any ambiguity ?
It isn’t about the tools you use. You need to start with good source material. Each of the AddOhms videos takes about 100 hours of script writing and less than 40 of animation. My software tools include Adobe After Effects, Illustrator, Apple’s Motion, Final Cut Pro X, and a handful of plugins to do various things.
As for hardware, I have a variety of cameras. The biggest asset there are a good microphone and good lights. I would invest in Microphone, Lights, Camera in that order. If you don’t have a camera already, then put more of your budget into microphone and lights, than the camera. You can upgrade that later.
Hi James,
I am really new to the Arduino and coding world. I used your tutorial on millis to test out a strobe flasher for off road race trucks. I used a TIP120 on the two outputs to strobe 18 watt LED pods. would it be possible to add in two more strobe channels without the code getting bogged down? Would it be possible to use an interrupt statement that would drive all the outputs to a constant high using a digital read? I’d like to be able to cycle from strobe to continuous on in other words.
I’ll keep experimenting!
Thanks for an awesome website,
Nick
1. To add more lights, you would simply duplicate the appropriate code. For example, you’d need to add new “State” variables, Pin Definitions, and digitalWrite() calls to support the additional lights.
2. You could use an interrupt, but I’m not sure how important that would really be. You could simply add a digitalRead() in the loop that sets the STATE variables to HIGH. Then the lights would stay on constantly. That’s the way this code works. The loop() sets the I/O pin to the state of variable. Then it checks to see if time has passed, which modifies the state. Add a digitalRead() and an if-statement and you’ve got your “interrupt”.
I would create a variable called “constant_STATE” then you could something like this in loop, right before the digitalWrite()s.
constant_STATE = digitalRead(2); // obviously, change to whatever pin you're using
if (constant_STATE == true) {
Red_State = true;
Blue_State = true;
}
digitalWrite //...
Now regardless of what the rest of the “timing code” does, the lights will always be forced to “on”, if the input pin is high…
Thanks for the prompt reply! I’ll give it a shot.
Hi James-
I came across your website when I was looking for forums on LED lights. I am probably an idiot but we are having problems with LED strip lights.
My brother owns a small grocery store and he just purchased LED strip lights for his freezer cases. We got all of them hooked up with the appropriated drivers and even have them hooked up to a motion sensor. they all seem to work great EXCEPT FOR TWO OF THE STRIPS ARE DIM at each end of the case. we have a total of 16 strip lights hooked up with drivers for every two strip lights. Again, all of them work great, except for two.
We are completely baffled. we tried different drivers and they are still dim. we tried reversing the polarity and they are still dim. Each strip light is less then 5 feet away, from the driver, so we don’t think voltage drop is an issue.
The only thing that we can diagnose, is that the problem is occurring when a 5′ strip light is on the same driver as a 4′ strip light (the 4′ strip light is the one that remains dim, which seems weird).
We tested our theory by unhooking the 4′ strip light and hooking it up to an adjacent 5′ strip light and both 5′ strip lights (hooked to the same driver) worked just fine. Hooked the 4′ strip back up and it was dim again.
Would there be some kind of compatibility issue with mixing 4′ and 5′ strips together???
Any help would be greatly appreciated!!! This is driving up to drink!!! 😉
Thanks- Charlie
Sorry Charlie, I don’t have experience with those kind of LED strips. I don’t know how they are setup. Distance could absolutely be the issue since they do draw a relatively large amount of current. I’d expect the wiring used is meant for low voltage, which gives it somewhat high resistance. Run a bunch of current through long wires and you’ll see a voltage drop like you describe. However, I’m making a lot of guesses.
Hello James,
my Name is fribbe from http//:macherzin.net.
macherzin.net is a not commercial website concentrating on all aspect of physical computing.for German speaking users.
We would like to translate and publish some of your project.s. Of course the source – your site – will be credited.
However: we are asking for your allowance.
Am am bold, too …
Best regards
fibbe (MOD @ macherzin.net)
.
Hi, I think I’d be more comfortable if you selected particular posts for translation.
Also, I have some native speakers as friends who I’d like to review, if you don’t mind.
Thanks,
James