07/22/2020
The impact of the COVID-19 pandemic is increasing each day. The pandemic is suspicious at best; many questions unanswered at least truthfully. Its origin, highly probable, is China but was it weaponized? Did it leak out accidentally, maybe before it was totally weaponized or was this a trial run? Is it truly worse than a bad flu season? Have the case numbers and deaths been falsified or exaggerated?
One obvious observation is that the Left’s true nature, their agenda is now visibly on display!
Anyone even partially awake can observe and remove themselves from the “useful idiot” group.
If the actions of Left leaning elected officials has not caused the general public of the United States to wake up to the evil reality it will be to late. November 2020 will soon tell.
COVID-19 has impacted me. The largest impact on me is observing the evil that reared its ugly head is disturbing, pockets of chaos / anarchy and the willingness of citizens to take part.
This COVID-19 has taken more of my freedoms away, under the guise of health and safety. It is very difficult to do anything and go anywhere whenever I want. I have enough to keep me busy but knowing that I do not have a choice is very troubling. Am I actually experiencing a taste of others living in Marxist, socialist, Muslim or tightly controlled governments? How much worse will it get? Does the average US Citizen really like there current experience?
What keeps me busy during this Covid season? Visiting doctors after May 2020 for non-Covid reasons, short trips to nearby foothills and mountains, limited visits with grandchildren and great grandchildren, God’s Word and Christian podcasts, digitizing slides and pictures and STEM projects.
For about two years I had this idea of repurposing a broken 12 volt Fischer Price Powerwheel so that it can be programmed to travel around a dirt road block. What better time to make that happen than under the “spell” of COVID-19?
After completing a major milestone for a semi-autonomous Fischer Price Powerwheels, I was reminded of the similarity between this project and the Christian Faith.
I realize how important it is to delve deep into God’s Word and avoid as many mistakes and side paths from the “straight and narrow”.
I purchased about 50 Grove STEM sensors with the idea of putting them to use with a Raspberry Pi or Arduino. They remained in a plastic organization case waiting to be discovered. In the past I had several Bibles that were opened periodically. I opened my case of sensors periodically as well but did not actually connect them to a device. Life gets in the way reducing time spent reading and ingesting God’s Word. In both cases I do not experience the treasures inside unless I open the Bible and plastic case. There are many traditions and doctrines practiced in the Christian faith; are they all Biblical? I have discovered that many are not. It is easy to find a defender of these traditions, many of which are in a church pulpit and come from a seminary! who am I to question an individual with a divinity degree? They must know more than I, right? Yes and no. They may know Greek and Hebrew but they were taught by flawed humans. Without the Master Teacher, the Holy Spirit, and critical thinking parishioners and seminary students blindly believe and follow unbiblical teaching.
In order to use a STEM sensor I typically have to load an existing Github library and look at some examples of how to access it. Then adapting the sensor for my own project may require more research on programming and any limitations so I do not destroy the sensor or my Arduino computer. Recently, I came across an error in a library and posted my find. The error was corrected in about 6 hours! Similarly, if I am trying to find about “church”, research is required to find out what a church was in God’s Word and compare with church today. It is obvious that differences exist, so how did those differences come to be? This requires more research to discover the change, usually starting with the “church fathers”. In many cases the changes started subtlety with a “church father” and within 300 years the original morphed into obvious error. However, that error became tradition and widely accepted. Unfortunately, I have discovered that the term “church father” should have been church historian and not be readily treated as Truth, above or equal to Scripture! Churches have had the Truth in the pews for nearly 1500 years yet the errors still exist!
The COVID quarantine provided the opportunity to put my Powerwheels idea into action. My first idea was to mimic each mechanical piece in the Powerwheels system such as turning on the system. Had I not researched the sensors I had on hand to determine their limitations several parts would have been destroyed. I am supposed to “mimic” or better, follow the Foundation as the Holy Sprit directed the Apostles. How can I know what the Foundation is if I do not listen to the Holy Spirit as I “eat” God’s Word? I must not make the mistake of letting someone educated by a seminary tell me what the Foundation is or means without checking it out.
My STEM Powerwheels project follows.
I had this idea of having a 12VPowerWheels (Mattel or Fischer Price) “driving” in my neighborhood without human intervention.
While the COVID quarantine was in progress I decided to see about bringing my idea to reality. First, I deconstructed two Powerwheels. One was completely dismantled exposing all the electrical wires and mechanicals switches. The next step was to create a schematic diagram of each function (throttle, on/off pedal button switch, forward and reverse and motor controller. For example, the lever that controlled forward and reverse basically move a set of wires to opposite contacts reversing the polarity. (See Schematic)
A plan was forming to use an Arduino UNO with a Grove shield to simulate the mechanical tasks. Research began to see if I had all the components to accomplish the task. I had several Grove Relays but realized that they were primarily for AC, not DC, projects. They could handle small DC projects but less than 2Amps. This required to track down the specs for the powerwheels. Typically, the amperage of the system averaged 3-4 amps with spikes reaching 7amps. I tested the amperage of each motor and tried to stall the motor which would be worse case. The system produced3-4 amps with spikes of 7-10 amps. Therefore, I did not have the required parts.
The correct Motor Driver had to be researched as the amperage is limited to 2 AMPs on most Motor Drivers. The Pololu was a kit needing soldering, which I have trouble seeing to solder, so I chose the HiLetgo VNH5019 2-Channel DC Motor Driver Board 30A High Current With Voltage Protection VNH2SP30 Upgrade Support which comes completed.
This research changed my goal to mimic each powerwheel function to controlling the motors. Therefore, all other wiring and mechanical components were removed
Next step was to order the parts and start programming an Arduino IDE sketch. The first sketch was a simple approach to pushing a Grove Sensor button which would start the motors.
- :\0_STEM\Arduino\PowerWheels
- :\0_STEM\Arduino\PowerWheels\myPowerWheels_old2 : testing ( limited coding)
- :\0_STEM\Arduino\PowerWheels\myPowerWheels2Rv2 : works as of 071520
- //Powerwheels: 06/26/2020
- //Works with the following settings: as of 07/15/2020
- // A0 button switch
- // A3 rotary angle sensor
- // D3 Touch pad (was D4 may have been conflict with DUal motor driver!) 07/15/2020
- // Looking at the dual motor board documentation diagram
- // Pins 2 and 4 are linked to M1NA and M1NB!?
- // D6 Ultrasonic sensor
- // D5 4 digit display
- // LCD I2C
- //NOTE: start both Rotary Angle Sensors at “0” degrees
- //Added Libraries:
- // Accelerometer_ADXL345-master
- // Grove LCD RGB Backlight
- // Utrlsonic Ranger
- // 4 Digit Display
- // Rotary Encoder v1.1
- // Touch Sensor does not have a Library
One problem I had with my first Arduino sketch was having to come in the house to modify the motor speeds for proper tuning. This required a way to detect when and how to change the speeds without having to reprogram the sketch. I chose the Angular Encoder which could be used to pick which motor speed to change and use one Angular rotator to change the speed. I had to change the logic to use the Touch Sensor to signal motor speed change and then use the rotator to increase or decrease the speed. Then to signal when finished with one motor use the Button Sensor. Then the next motor would be next. Using the Touch Sensor again to signal when finished tuning the motors. By then the Button Switch would have time to debounce which would start the motor/vehicle.
Another setback was the Grove angular Encoder. I have had trouble with this sensor before. It is sensitive to shorting and coming apart. Could not order another one quickly so decided to use two Angular Rotator Sensors and the Touch Sensor.
myPowerWheels2Rv2.ino coding was completed 071520
The logic to change motor speed using rotary angle sensors, TouchPin and Button was working last week but the motors would not work. After using myPowerWheels_old2.ino which did work it was determined that it must be a sensor conflicting with the Dual MotorDriver. Looked at the Motor driver documentation the PWM pins which controlled M1NA and B used pins 2,4 AND M2NA and M2NB used pins 7 and 8. Moved the Touch Sensor to PIN D3 on the Grove Shield. The motors now worked!
TO speed up the testing, I found some 12V motors from VHS players etc. which could be powered by a simple 9V battery.
This made testing much quicker than going outside to check with the powerwheels.
Project Pictures
Grove Sensors used
4 digit display, touch, button, 16×2 RGB display, Rangefinder, 2x Grove – rotary angel sensor
Sensors, Motor driver board, Grove shield and Sparkfun black board connected to battery and wheels for test run
Video of First Test Drive:
https://1drv.ms/f/s!AswAQ9RsvGUIthresspRiLd5kvSw
Project Notes:
- Find a way to attach the front wheels
- Use Arduino and 9volt battery to stop the 12V to the back wheel motors
- 1st attempt will be both motors
- on/off
- Test cycling 12V to slow down and speed up motors
- can one relay be used for forward and one for reverse?
- Use the Grove Relay
- use Grove Range finder to make sure the car does not bump into an object
- Map the wires in the Powerwheels, create schematic diagram
- Research parts:
- Found the motors used and discovered that the Amperage can be high:
- Need to measure it though before possibly ruining my Arduino parts
- The Amperage is too high for common Arduino/Grove motor drivers and maybe relays.
- The initial plan to remove relays to control stop/start, throttle/acceleration and forward/ reverse was scrapped for the moment due to the high current.
- Asked SparkFun. Their answer came after I found the one they recommended. There recommendation was
- Pololu From <https://github.com/pololu/dual-vnh5019-motor-shield> which was a kit requiring soldering. My eyesore is not that good anymore so I found a competitor.
- Purchased:
- HiLetgo VNH5019 2-Channel DC Motor Driver Board 30A High Current With Voltage
- Operating voltage range: 5.5V- 24V
- · 5V to 12V operating voltage
- · L298P, drives two DC motors or one stepper motor
- · 2A per channel or 4A maximum current
- · 1.65V/A current sensing
- Free running stop and brake function
- From <https://www.newark.com/arduino/a000079/add-on-card-motor-shield-r3/dp/78T1603?afsrc=1&CMP=AFF-CJ-9069228-Newark+Redirect+Link&source=CJ&cjevent=814c41b3bb5711ea82b100570a1c0e0e>
- https://os.mbed.com/users/ianmcc/code/VNH5019/file/b5f360a16354/VNH5019.h/
- SparkFun BlackBoard UNO (use cheaper first)
- SparkFun RedBoard UNO with wireless
- Another Grove shield for Arduino
- · SparkFun BlackBoard basic specs
- · ATmega328P microcontroller with Optiboot (UNO) Bootloader
- · CH340C USB to Serial IC
- · Reinforced and reversible USB C connector
- · Built-in Qwiic connection
- · Input voltage: 7-15V
- · 0-5V outputs with 3.3V compatible inputs
- · 14 Digital I/O Pins (6 PWM outputs)
- · 6 Analog Inputs
- · ISP Header
- · 32k Flash Memory
- · 16MHz Clock Speed
- · Flat bottom, all SMD construction
- From <https://www.sparkfun.com/products/16282>
- Have Parts:
- Grove-Ultrasonic Ranger
- Grove- 3-axis Digital +-16g accelerometer
- Obtain Arduino Libraries for all the above parts
- Add Libraries to Arduino Sketch
- Obtain sample code for each
- Grove Touch 1.0
- D2 or Dn
- · Operating Voltage: 2.0 – 5.5V
- · Operating Current(Vcc=3V):1.5 – 3.0μA
- · Operating Current(VDD=3V):3.5 – 7.0μA
- · Output Response Time: 60 – 220mS
- · Used Chipset: TTP223-BA6
- From <https://wiki.seeedstudio.com/Grove-Touch_Sensor/>
- const int TouchPin = 9;
const int ledPin = 3;
void setup() {
pinMode(TouchPin, INPUT);
pinMode(ledPin, OUTPUT);
} - void loop() {
int sensorValue = digitalRead(TouchPin);
if (sensorValue == 1){
digitalWrite(ledPin, HIGH);
}
else{
digitalWrite(ledPin, LOW);
}
} - From <https://www.hackster.io/trduunze/grove-starter-kit-for-arduino-touch-sensor-6dea64>
- const int TouchPin=2; //Attached to D2
- const int ledPin=3;
- void setup() {
- pinMode(TouchPin, INPUT);
- pinMode(ledPin,OUTPUT);
- }
- void loop() {
- int sensorValue = digitalRead(TouchPin);
- if(sensorValue==1)
- {
- digitalWrite(ledPin,HIGH);
- }
- else
- {
- digitalWrite(ledPin,LOW);
- }
- }
Product Version | Changes | Released Date |
Grove-Rotary Angle Sensor(P) V1.1 | Initial | Jan 2013 |
Grove-Rotary Angle Sensor V1.2 | Initial | May 2014 |
From <https://wiki.seeedstudio.com/Grove-Rotary_Angle_Sensor/>
Grove-Rotary Angle Sensor V1.2 | Initial | May 2014 |
From <https://wiki.seeedstudio.com/Grove-Rotary_Angle_Sensor/>
Item | Min | Typical | Max | Unit |
Voltage | 4.75 | 5.0 | 5.25 | VDC |
Rotary Angle | 0 | / | 300 | Deg |
Dimension | / | 19x19x30.1 | / | mm |
- Connect Grove-Rotary Angle Sensor to A0 or An port of Grove-Base Shield.
- /*macro definitions of Rotary angle sensor and LED pin*/
- #define ROTARY_ANGLE_SENSOR A0
- #define LED 3 //the Grove – LED is connected to PWM pin D3 of Arduino
- #define ADC_REF 5 //reference voltage of ADC is 5v.If the Vcc switch on the seeeduino
- //board switches to 3V3, the ADC_REF should be 3.3
- #define GROVE_VCC 5 //VCC of the grove interface is normally 5v
- #define FULL_ANGLE 300 //full value of the rotary angle is 300 degrees
- void setup()
- {
- Serial.begin(9600);
- pinMode(ROTARY_ANGLE_SENSOR, INPUT);
- pinMode(LED,OUTPUT);
- }
- void loop()
- {
- float voltage;
- int sensor_value = analogRead(ROTARY_ANGLE_SENSOR);
- voltage = (float)sensor_value*ADC_REF/1023;
- float degrees = (voltage*FULL_ANGLE)/GROVE_VCC;
- Serial.println(“The angle between the mark and the starting position:”);
- Serial.println(degrees);
- int brightness;
- brightness = map(degrees, 0, FULL_ANGLE, 0, 255);
- analogWrite(LED,brightness);
- delay(500);
- }
- Seeed-Studio/Rotary_Angle_Sensor
- From <https://github.com/Seeed-Studio/Rotary_Angle_Sensor>
- Grove – Encoder v1.1
- From <https://wiki.seeedstudio.com/Grove-Encoder/>
Item | Min | Typical | Max | Unit |
Voltage | 4.5 | 5 | 5.5 | V |
Current | 10 | 20 | 30 | mA |
Dimension | 20x 20 | mm | ||
Net Weight | 12 | g |
- Connect Grove-Encoder to port D2 of Grove-Base Shield.
- #include <CircularLED.h>
- #include <Encoder.h>
- #include <TimerOne.h>
- CircularLED circularLED(6,5);
- unsigned int LED[24];
- int index_LED;
- void setup()
- {
- encoder.Timer_init();
- }
- void loop()
- {
- if (encoder.rotate_flag ==1)
- {
- if (encoder.direct==1)
- {
- index_LED++;
- if (index_LED>23)
- index_LED=24;
- SenttocircularBar(index_LED);
- }
- else
- {
- index_LED–;
- if(index_LED<0)
- index_LED=0;
- SenttocircularBar(index_LED);
- }
- encoder.rotate_flag =0;
- }
- }
- void SenttocircularBar(int index)
- {
- for (int i=0;i<24;i++)
- {
- if (i<index)
- {
- LED[i]=0xff;
- }
- else
- LED[i]=0;
- }
- circularLED.CircularLEDWrite(LED);
- }
- Step 4. The light will be changed as encoder
- Ghttps://github.com/Seeed-Studio/Seeed_Arduino_RotaryEncoderrove encoder library
- https://lastminuteengineers.com/rotary-encoder-arduino-tutorial/amp/
- Grove – 4-Digit Display v1.0
- From <https://wiki.seeedstudio.com/Grove-4-Digit_Display/>
- https://github.com/Seeed-Studio/Grove_4Digital_Display
- Grove – 3 Axis Digital Accelerometer(±16g); Grove I2C
- Wide power range DC3V to 5V
- https://www.seeedstudio.com/Grove-3-Axis-Digital-Accelerometer-16g.html
- Download the Digital Accelerometer(±16g) Library
- #include <ADXL345.h> // 3-axis digital accelerometer
- ADXL345 adxl; //variable adxl is an instance of the ADXL345 library
- Grove – rotary angel sensor v1.2 Grove board A0, A1, A2, A3
- https://wiki.seeedstudio.com/Grove-Rotary_Angle_Sensor/
- Grove Relay v1.1; D4 or (Dn)
- https://wiki.seeedstudio.com/Grove-Relay/
Parameter | V1.1 | V1.2 |
Product Release Date | 27th Jan 2013 | 9th June 2014 |
Operating Voltage | 5V | 3.3V~5V |
Operating Current | 60mA | 100mA |
Relay Life | 100,000 Cycle | 100,000 Cycle |
Max Switching Voltage | 250VAC/30VDC | 250VAC/30VDC |
Max Switching Current | 5A | 5A |
- · FULIHUA 12 Volt 30000RPM Gearbox for Powered Wheel Accessories, Kids Powered Ride On Car 12V Electric Motor with Gear Box RS550 Match Children Ride-Ons Replacement Parts
- · Kids Electric Cars 550 12V 30000RPM Gearbox
- · Drive engine is made of high strength plastic board combined with high quality motor
- · Shaft Hole Diameter: 20.mm (0.79″); Length: 200mm(7.88″)
- · Voltage: DC 12V , Speed: 30000RPM
- · Product is Applied to Specific Children Riding Toys . Please Make Sure the Purchased Part Has Same Appearance as the Original One
- · Power:45W
- Brand Name:WSJ
- Use:Kids Powerd Ride on Car SUV
- Model Number:RS550
- For Vehicle Type:SUV,Big Car,DIY refited Vehicle
- Supplies:Battery
- Power:45W
- Material:Plastic
- The new upgrade! children electric car gearbox
- 550 Mid-range upgrade to 4 teeth, stronger and more durable !!!
- Note:
- The speed faster and the torque smaller,In turn,The speed slower and the torque greater
- If the motor speed more than 10000 rpm, must to be dual drive
- This gearbox left and right there is no difference, change the positive and negative can change the direction of the gearbox 550 the power and torque greater than 390
- Voltage: 12V
- 12v 45w
- 3.75 amps
- Arduino IDE Grove Relay
- // Relay Control
- void setup()
- {
- pinMode(2, INPUT); //push button #1
- pinMode(3, INPUT); //push button #2
- pinMode(4, OUTPUT); //Relay
- }
- void loop()
- {
- if (digitalRead(2)==HIGH) //Pushed button #1 turn (High) on Relay to connect the wire (High) On
- {
- digitalWrite(4, HIGH);
- delay(100);
- }
- if (digitalRead(3)==HIGH) //Pushed button #2 turn (High) on Relay to dis-connect the wire (Low) Off
- {
- digitalWrite(4, LOW);
- }
- }
- The relay controls the positive wire to the 12V battery
- One end goes to battery, the other end goes to Powerwheel circuit.
- The Negative wire goes from the battery to the powerwheel circuit directly
- The Relay is a digital On/Off switch.
- Accelerometer: [Not correct accelerometer, see below]
- #include <Wire.h>
#include “MMA7660.h”
MMA7660 accelemeter;
void setup() - accelemeter.init();
Serial.begin(9600);
}
void loop()
{
int8_t x;
int8_t y;
int8_t z;
float ax,ay,az;
accelemeter.getXYZ(&x,&y,&z);
Serial.print(“x = “);
Serial.println(x);
Serial.print(“y = “);
Serial.println(y);
Serial.print(“z = “);
Serial.println(z);
accelemeter.getAcceleration(&ax,&ay,&az);
Serial.println(“accleration of X/Y/Z: “);
Serial.print(ax);
Serial.println(” g”);
Serial.print(ay);
Serial.println(” g”);
Serial.print(az);
Serial.println(” g”);
Serial.println(“*************”);
delay(500);
} - From <https://www.hackster.io/ingo-lohs/grove-introduction-in-3-axis-digital-accelerometer-ea05c3>
********* SEEED-STUDIO gitHub
https://github.com/Seeed-Studio
**************************************
https://github.com/Seeed-Studio/Grove_Ultrasonic_Ranger
https://wiki.seeedstudio.com/Grove-Ultrasonic_Ranger/
Operating voltage | 3.2~5.2V |
- Range Finder: Grove D2
- #include “Arduino.h”
- class Ultrasonic
- {
- public:
- Ultrasonic(int pin);
- void DistanceMeasure(void);
- double microsecondsToCentimeters(void);
- double microsecondsToInches(void);
- private:
- int this_pin;//pin number of Arduino that is connected with SIG pin of Ultrasonic Ranger.
- long duration;// the Pulse time received;
- };
- Ultrasonic::Ultrasonic(int pin)
- {
- this_pin = pin;
- }
- /*Begin the detection and get the pulse back signal*/
- void Ultrasonic::DistanceMeasure(void)
- {
- pinMode(this_pin, OUTPUT);
- digitalWrite(this_pin, LOW);
- delayMicroseconds(2);
- digitalWrite(this_pin, HIGH);
- delayMicroseconds(5);
- digitalWrite(this_pin,LOW);
- pinMode(this_pin,INPUT);
- duration = pulseIn(this_pin,HIGH);
- }
- /*The measured distance from the range 0 to 400 Centimeters*/
- double Ultrasonic::microsecondsToCentimeters(void)
- {
- return duration/29.0/2.0;
- }
- /*The measured distance from the range 0 to 157 Inches*/
- double Ultrasonic::microsecondsToInches(void)
- {
- return duration/74.0/2.0;
- }
- Ultrasonic ultrasonic(2);
- void setup()
- {
- Serial.begin(9600);
- }
- void loop()
- {
- double RangeInInches;
- double RangeInCentimeters;
- ultrasonic.DistanceMeasure();// get the current signal time;
- RangeInInches = ultrasonic.microsecondsToInches();//convert the time to inches;
- RangeInCentimeters = ultrasonic.microsecondsToCentimeters();//convert the time to centimeters
- Serial.println(“The distance to obstacles in front is: “);
- Serial.print(RangeInInches);//0~157 inches
- Serial.println(” inch”);
- Serial.print(RangeInCentimeters);//0~400cm
- Serial.println(” cm”);
- delay(1000);
- }
https://wiki.seeedstudio.com/Grove-LCD_RGB_Backlight/
https://github.com/Seeed-Studio/Grove_LCD_RGB_Backlight
Input Voltage | 5V |
// Turn off the display: | |
lcd.noDisplay(); | |
delay(500); | |
// Turn on the display: | |
lcd.display(); | |
delay(500); |
From <https://github.com/Seeed-Studio/Grove_LCD_RGB_Backlight/blob/master/examples/Display/Display.ino>
- Voltage divider : Grove A0 or An
- void setup()
- {
- Serial.begin(9600);
- }
- void loop()
- {
- long sensorValue=analogRead(A0);
- long sum=0;
- for(int i=0;i<1000;i++)
- {
- sum=sensorValue+sum;
- sensorValue=analogRead(A0);
- delay(2);
- }
- sum=sum/1000;
- Serial.print(“if you set the Gain to 10,the input voltage:”);
- Serial.println(10*sum*4980/1023.00);
- Serial.print(“if you set the Gain to 3,the input voltage:”);
- Serial.println(3*sum*4980/1023.00);
- delay(1000);
- }
All that the code does is reads the analog value and does some mathematics and prints it out on a serial monitor. The processed data can be used to control a robot which I will show soon.
- void setup(){
- Serial.begin(9600);
} - void loop(){
- long sensorValue=analogRead(A0);
- long sum=0;
- for(int i=0;i<1000;i++)
- {
- sum=sensorValue+sum;
- sensorValue=analogRead(A0);
- delay(2);
- }
- sum=sum/1000;
- Serial.print(“if you set the Gain to 10,the input voltage:”);
Serial.println(10*sum*4980/1023.00);
Serial.print(“if you set the Gain to 3,the input voltage:”);
Serial.println(3*sum*4980/1023.00); - delay(1000);
}
PiFace
https://www.raspberryconnect.com/projects/42-hardware-addons/124-piface-digital
https://pypi.org/project/pifaceio/
- https://www.element14.com/community/docs/DOC-69001/l/piface-digital-2-for-raspberry-pi (newer model)
- SparkFun Qwiic Quad Relay
- Out of stock COM-15102
- From <https://www.sparkfun.com/products/15102?_ga=2.187845032.1649122837.1592783142-1042491543.1524073607>
- https://arduino.stackexchange.com/questions/604/arduino-motor-shield-orange-white-pin-usage
- According to Ohms Law (I=E/R or Amps=Volts/Ohms) if the voltage in the circuit remains constant and the resistance is increased, the current should decrease. Try adding resistance to the circuit to lower the current output.
- From <https://www.google.com/search?source=hp&ei=0H3yXuf3BYittQbO66u4Aw&q=how+to+reduce+amperage+of+two+DC+motors&oq=how+to+reduce+amperage+of+two+DC+motors&gs_lcp=CgZwc3ktYWIQAzIFCCEQqwIyBQghEKsCMgUIIRCrAjoFCAAQsQM6BQgAEIMBOgIIADoGCAAQFhAeOggIABAWEAoQHjoICCEQFhAdEB46BQghEKABOgcIIRAKEKABUPVhWLi-AWDCwAFoAXAAeACAAasCiAG3K5IBBjAuMzcuMpgBAKABAaoBB2d3cy13aXqwAQA&sclient=psy-ab&ved=0ahUKEwjnn4KC-pjqAhWIVs0KHc71CjcQ4dUDCAk&uact=5>
- TinkerKit 4 pin Wires
- From <https://store.robotmesh.com/tinkerkit-4-pin-wires-55cm-21-5in?___SID=U>
- https://learn.sparkfun.com/tutorials/microclimate-kit-experiment-guide
- Wiring for DC motors speed and direction:
- From <https://www.amazon.com/Dikley-Dual-Channel-Driver-Module-Arduino/dp/B078M1NC3L/ref=sr_1_22?dchild=1&keywords=arduino+high+amperage+motor+shield&qid=1592952500&s=industrial&sr=1-22>
- DC Motor Driver:
- Contacted SparkFun for advice on correct driver for powerwheels high current.
- They confirmed the one I chose: VNH5019 driver
- Unfortunately we don’t carry a motor driver large enough for the size motors you’re wanting to drive, but our friends at Pololu have a driver that would work for you. Check out their VNH5019 driver, I think that will work for you. 🙂
- · Pololu Dual VNH5019 Motor Driver Shield for Arduino
- I have a HiLetGo version which claims the ability of 12A continuous and 30A periodic Maximum.
- Need to measure the amps on each motor: Normal, a slight load and Stall load.
- Normal: 1-2Amps
- Slight load: 3-4 Amps
- Stall Load: Needs testing, could not easily stop the motor. Will put in protections – emergency stop is current goes too high.
- Still unknown is if the motors are synced to go forward or if one motor needs wires reversed.
- Library:
- 3.d. Programming Your Arduino
- Our Arduino library for the dual VNH5019 motor driver shield makes it easy to get started writing your
- Arduino sketches. A link to download the library, installation instructions, and the library command
- reference can be found on the library’s github page [http://github.com/pololu/dual-vnh5019-motor-shield].
- Once installed, we recommend you try out the example sketch by selecting
- File > Examples > DualVNH5019MotorShield > Demo
- #include “DualVNH5019MotorShield.h”
- DualVNH5019MotorShield md;
- void stopIfFault()
- {
- if (md.getM1Fault())
- {
- Serial.println(“M1 fault”);
- while(1);
- }
- if (md.getM2Fault())
- {
- Serial.println(“M2 fault”);
- while(1);
- }
- }
- // ***
- void setup()
- {
- Serial.begin(115200);
- Serial.println(“Dual VNH5019 Motor Shield”);
- md.init();
- }
- // ***
- void loop()
- {
- for (int i = 0; i <= 400; i++)
- {
- md.setM1Speed(i);
- stopIfFault();
- if (i%200 == 100)
- {
- Serial.print(“M1 current: “);
- Serial.println(md.getM1CurrentMilliamps());
- }
- delay(2);
- } // *** End For
- // *** Check Motor 1 *******
- for (int i = 400; i >= -400; i–) // *** M1: Forward Test ***
- {
- md.setM1Speed(i);
- stopIfFault();
- if (i%200 == 100)
- {
- Serial.print(“M1 current: “);
- Serial.println(md.getM1CurrentMilliamps());
- }
- delay(2);
- } // *** End For
- // ***
- for (int i = -400; i <= 0; i++) // *** M1: Reverse Test ***
- {
- md.setM1Speed(i);
- stopIfFault();
- if (i%200 == 100)
- {
- Serial.print(“M1 current: “);
- Serial.println(md.getM1CurrentMilliamps());
- }
- delay(2);
- } // *** End For
- // *** Check Motor 2 *******
- for (int i = 0; i <= 400; i++)
- {
- md.setM2Speed(i);
- stopIfFault();
- if (i%200 == 100)
- {
- Serial.print(“M2 current: “);
- Serial.println(md.getM2CurrentMilliamps());
- }
- delay(2);
- } // *** End For
- // ***
- for (int i = 400; i >= -400; i–) // *** M2: Forward Test ***
- {
- md.setM2Speed(i);
- stopIfFault();
- if (i%200 == 100)
- {
- Serial.print(“M2 current: “);
- Serial.println(md.getM2CurrentMilliamps());
- }
- delay(2);
- } // *** End For
- // ***
- for (int i = -400; i <= 0; i++) // *** M2: Reverse Test ***
- {
- md.setM2Speed(i);
- stopIfFault();
- if (i%200 == 100)
- {
- Serial.print(“M2 current: “);
- Serial.println(md.getM2CurrentMilliamps());
- }
- delay(2);
- } // *** End For
- } // End Void loop
- void loop()
- {
- for (int i = 0; i <= 400; i++)
- {
- md.setM1Speed(i);
- stopIfFault();
- if (i%200 == 100)
- {
- Serial.print(“M1 current: “);
- Serial.println(md.getM1CurrentMilliamps());
- }
- delay(2);
- } // *** End For
- // *** Check Motor 1 *******
- for (int i = 400; i >= -400; i–) // *** M1: Forward Test ***
- {
- md.setM1Speed(i);
- stopIfFault();
- if (i%200 == 100)
- {
- Serial.print(“M1 current: “);
- Serial.println(md.getM1CurrentMilliamps());
- }
- delay(2);
- } // *** End For
- // ***
- for (int i = -400; i <= 0; i++) // *** M1: Reverse Test ***
- {
- md.setM1Speed(i);
- stopIfFault();
- if (i%200 == 100)
- {
- Serial.print(“M1 current: “);
- Serial.println(md.getM1CurrentMilliamps());
- }
- delay(2);
- } // *** End For
- // *** Check Motor 2 *******
- for (int i = 0; i <= 400; i++)
- {
- md.setM2Speed(i);
- stopIfFault();
- if (i%200 == 100)
- {
- Serial.print(“M2 current: “);
- Serial.println(md.getM2CurrentMilliamps());
- }
- delay(2);
- } // *** End For
- // ***
- for (int i = 400; i >= -400; i–) // *** M2: Forward Test ***
- {
- md.setM2Speed(i);
- stopIfFault();
- if (i%200 == 100)
- {
- Serial.print(“M2 current: “);
- Serial.println(md.getM2CurrentMilliamps());
- }
- delay(2);
- } // *** End For
- // ***
- for (int i = -400; i <= 0; i++) // *** M2: Reverse Test ***
- {
- md.setM2Speed(i);
- stopIfFault();
- if (i%200 == 100)
- {
- Serial.print(“M2 current: “);
- Serial.println(md.getM2CurrentMilliamps());
- }
- delay(2);
- } // *** End For
- } // End Void loop
- // *** End For
- // ***
- for (int i = 400; i >= -400; i–) // *** M2: Forward Test ***
- {
- md.setM2Speed(i);
- stopIfFault();
- if (i%200 == 100)
- {
- Serial.print(“M2 current: “);
- Serial.println(md.getM2CurrentMilliamps());
- }
- delay(2);
- } // *** End For
- // ***
- for (int i = -400; i <= 0; i++) // *** M2: Reverse Test ***
- {
- md.setM2Speed(i);
- stopIfFault();
- if (i%200 == 100)
- {
- Serial.print(“M2 current: “);
- Serial.println(md.getM2CurrentMilliamps());
- }
- delay(2);
- } // *** End For
- } // End Void loop
********* Another examole:
- {
- // loops endlessly; main loop goes here
- // the following code is a simple example:
- md.setM1Speed(400); // single-channel motor full-speed “forward”
- delay(2000); // wait for 2 seconds
- md.setM1Speed(0); // single-channel motor stop (coast)
- delay(500); // wait for 0.5 s
- md.setM1Speed(-400); // single-channel motor full-speed “reverse”
- delay(2000); // wait for 2 seconds
- md.setM1Speed(0); // single-channel motor stop (coast)
- delay(500); // wait for 0.5 s
- }
- Commands listed on GitHub:
- · DualVNH5019MotorShield()
Default constructor, selects the default pins as connected by the motor shield. - · DualVNH5019MotorShield(unsigned char INA1, unsigned char INB1, unsigned char PWM1, unsigned char EN1DIAG1, unsigned char CS1, unsigned char INA2, unsigned char INB2, unsigned char PWM2, unsigned char EN2DIAG2, unsigned char CS2)
Alternate constructor for shield connections remapped by user. If PWM1 and PWM2 are remapped, it will try to use analogWrite instead of timer1. - · void init()
Initialize pinModes and timer1. - · void setM1Speed(int speed)
Set speed and direction for motor 1. Speed should be between -400 and 400. 400 corresponds to motor current flowing from M1A to M1B. -400 corresponds to motor current flowing from M1B to M1A. 0 corresponds to full coast. - · void setM2Speed(int speed)
Set speed and direction for motor 2. Speed should be between -400 and 400. 400 corresponds to motor current flowing from M2A to M2B. -400 corresponds to motor current flowing from M2B to M2A. 0 corresponds to full coast. - · void setSpeeds(int m1Speed, int m2Speed)
Set speed and direction for motor 1 and 2. - · void setM1Brake(int brake)
Set brake for motor 1. Brake should be between 0 and 400. 0 corresponds to full coast, and 400 corresponds to full brake. - · void setM2Brake(int brake)
Set brake for motor 2. Brake should be between 0 and 400. 0 corresponds to full coast, and 400 corresponds to full brake. - · void setBrakes(int m1Brake, int m2Brake)
Set brake for motor 1 and 2. - · unsigned int getM1CurrentMilliamps()
Returns current reading from motor 1 in milliamps. See the notes in the “Current readings” section below. - · unsigned int getM2CurrentMilliamps()
Returns current reading from motor 2 in milliamps. See the notes in the “Current readings” section below. - · unsigned char getM1Fault()
Returns 1 if there is a fault on motor driver 1, 0 if no fault. - · unsigned char getM2Fault()
Returns 1 if there is a fault on motor driver 2, 0 if no fault. - Current readings
- From <https://github.com/pololu/dual-vnh5019-motor-shield>
- passing an argument in Arduino ide:
- You can’t return two times at once. You could pass b to your function by reference. You can’t return more than one value from a function in C. Either return a struct , or pass by reference and modify in the function
- From <https://www.google.com/search?safe=active&bih=800&biw=1492&hl=en&sxsrf=ALeKk03eE162c4RnKu3vw-xaCbtPRZMtlA:1593286287691&q=arduino+function+return+multiple+values&sa=X&ved=2ahUKEwj1z8_53aLqAhWaGs0KHTQsB2AQ1QIoAXoECAsQAg>
- [NOTE:
- It was determined that I needed an event to know when to activate the motor. Otherwise, once I download the sketch to the Arduino UNO the program (Void Loop) will start immediately. The is not good.
- Therefore, a simple event is a button push (Grove button). I assume that the button when released will connect to GND thus, the next time the button pin is read it will remain LOW unless pushed again.
- Could include a state change logic to keep track.
- But not all switches are created equal, and some will fluctuate between both state (this is called “bouncing” from LOW to HIGH) during the pressing of the switch and this can introduce multiple detected presses on the Arduino.
- Possible solutions:
- There are many ways to work around this problem, here are 2 simple ones, with their pros and cons:
- · Using a simple “delay()” function.
- · Using the “millis” function.
- Using a simple “Delay()” Function
- The way this works is when you start pressing the switch the first time the Arduino detects the desired state (LOW in this case) the delay() is started and waits between 50 and 200 milliseconds, this pauses the entire code on the Arduino until the delay is expired.
- The reasoning is that the delay will be long enough to not let the Arduino read the bouncing and only register one switch press. From <https://www.brainy-bits.com/arduino-switch-debounce/>
- https://www.arduino.cc/reference/en/language/functions/time/millis/
- https://www.arduino.cc/en/Tutorial/StateChangeDetection
- Option to not use void loop in sketch
- int main(void)
- {
- init();
- initVariant();
- #if defined(USBCON)
- USBDevice.attach();
- #endif
- setup();
- for (;;) {
- loop();
- if (serialEventRun) serialEventRun();
- }
- return 0;
- }
- From <https://forum.arduino.cc/index.php?topic=379368.0>
- ]
- SparkFun RedBoard Artemis
- DEV-15444
- From <https://www.sparkfun.com/orders/6147275>
- https://learn.sparkfun.com/tutorials/artemis-development-with-arduino?_ga=2.9242289.540514486.1593402300-1042491543.1524073607
- https://www.tensorflow.org/lite/microcontrollers
- SparkFun Red Board wireless
- https://learn.sparkfun.com/tutorials/hookup-guide-for-the-sparkfun-redboard-artemis
- Arduino A000079 Motor Shield, R3, 5V to 12V
- From <https://www.amazon.com/Arduino-A000079-Motor-Shield-12V/dp/B0084ZQF3O/ref=sr_1_3?dchild=1&hvadid=78065445501542&hvbmt=bp&hvdev=c&hvqmt=p&keywords=arduino+motor+driver+shield&qid=1593579094&sr=8-3&tag=mh0b-20>
- Operating Voltage 5V to 12V Motor controller L298P, Drives 2 DC motors or 1 stepper motor Max current 2A per channel or 4A max (with external power supply) Current sensing 1.65V/A Free running stop and brake function
- 07/02/2020
- Having trouble matching the wheel motors – getting both to turn at same speed.
- Now need to write a sketch using Grove sensors to manually adjust both motors and hoping find the best setting
- Grove – Touch
- Grove – Angular
- Increase/ decrease speed by 10
- Grove – 4 digit display to post the current
- Grove – RGB LCD for events
- Grove – Button for stop/start
- Encoder:
- In USA
- https://www.seeedstudio.com/Grove-12-bit-Magnetic-Rotary-Position-Sensor-AS5600-p-4192.html
- https://github.com/Seeed-Studio/Seeed_Arduino_AS5600
- https://www.seeedstudio.com/Grove-OLED-Display-1-12.html
- https://www.seeedstudio.com/Grove-OLED-Display-0-96.html
- https://www.seeedstudio.com/Grove-0-54-Red-Quad-Alphanumeric-Display-p-4032.html
- Not in US
- https://www.seeedstudio.com/Grove-Encoder.html
- https://www.seeedstudio.com/Rotary-Encoder-with-Switch-p-667.html
- https://www.seeedstudio.com/Grove-Mouse-Encoder.html
- Phase 1 Schematic
- Remove ON/OFF button and . Insert Arduino with relay. How to bypass the throttle? Only Forward in phase 1. Maybe add a rangefinder.