8513 forum posts
Yes, you might have a duff Uno or Shield. Values higher than 1023 suggest a hardware failure. My LCD Shield came from DF-Robot, and I've used Sunfounder several times without bother, but the breed do turn up poorly sometimes. I try to avoid the very cheap no-brand boards, but the few I've used have been OK (I think I've only had two failures in over 100 purchases.)
You might try this test program, which can be used to test the Uno because it doesn't need the LCD shield plugged in. Instead it reports to the IDE's Serial Monitor at 9600baud.
Compile and load it onto the bare Uno, then turn the serial monitor on and set the baud rate to 9600 baud.
With nothing plugged into pin A0 should display a random value between 0 and 1023 due to picking up mains hum. Connect a jumper wire from A0 to the 3.3V socket:
Mine read 647 which equates to 3.16V (Maths: v= 647/1023 * 5V)
Reconnecting the jumper from A0 to a Gnd socket should read 0
And connecting the jumper from A0 to the 5V socket should read 1023
DO NOT connect the jumper from A0 to Vin!!! It will probably fry the ADC function,
This proves the UNO is Ok.
Next plug the shield in. The display won't work, but pressing the buttons down for a few seconds should show the ADC level each causes.
Fingers crossed, both work.
I can't think of a reason why A0 should ever read more than 1023. Possibly the ADC circuit behind A0 is has been spiked. They're robust unless fed more than whatever is on the supply rail, which is 5.0V. I've never killed one, but static might do it.
|John Olsen||01/12/2021 05:30:03|
|1241 forum posts|
I've just been playing with an Arduino myself lately so found some of the above quite interesting.
A few points about speed and stepper motors. They can go quite fast, but sometimes need a few tricks. One is that in order to build up the current and hence the magnetic field quite quickly, the drive voltage can be increased. To avoid overcooking things when the motor is running slow or holding, this is done with either a constant current drive or more simply, a resistor in series. The high initial supply voltage gives a faster rise to the current, but the constant current part ensures that the current never exceeds what the winding is rated for.
Then there is the acceleration thing. Depending on the rotational inertia of the whole drive train, if you just start switching at a high speed, the rotor can lose lock. So the controller needs to be set up to accelerate at a reasonable rate, and similarly to decelerate at a reasonable rate. This requires that the controller knows in advance when it is going to be asked to stop the load, so is not so good for unplanned emergency stops. Really if high speeds and sudden changes are needed, a servo motor become a better solution.
I've just implemented some code from the web to allow using the Arduino to remotely display the output from the usual common digital calipers. The original code only did millimeters, so I have messed around a bit and after a few changes have got it to read out correctly for either millimeters or inches, including reading the fourth decimal place correctly. I might get around to doing a DRO for the Myford yet...
Please login to post a reply.
Want the latest issue of Model Engineer or Model Engineers' Workshop? Use our magazine locator links to find your nearest stockist!
You can contact us by phone, mail or email about the magazines including becoming a contributor, submitting reader's letters or making queries about articles. You can also get in touch about this website, advertising or other general issues.
Click THIS LINK for full contact details.
For subscription issues please see THIS LINK.