Week 1:
Actuators
Chapter 1:
Powering on the VirtualBench
Welcome to our first weekly workshop! Today, we're going to be looking at some of the actuators we'll be working with for Sumobots.
Today, we've given you a few components:
The main purpose of this lab is to get you used to working in the CTL, using the VirtualBench all in one electronics lab and getting a feel for what you can expect from the components we provide. Engineering is often flooded with equations and simulations, so this is a chance to get an intuitive feel for how these systems work in the real world.
We'll be providing you with your full bag of parts (including some better servos) in a later workshop (Workshop 3- Programming) where you'll learn about how to integrate a programmable controller into your robot. Next week, we'll show you how you can use CAD models of these components to quickly create 3D designs and get them ready for rapid prototyping.
Last off, we'll have plenty of catchup sessions throughout the process and we'll also be going more in depth on how to troubleshoot and find issues later on as you get more comfortable with the lab equipment. There's plenty of committee members around the lab ready to help you, so feel free to flag one of us down if you need a hand
Firstly, make sure the power button on the VirtualBench is glowing blue to show that it is turned on. Next, follow the video to connect it to your PC:
Next, open the NI VirtualBench App:
Once opened, you should be met with this:
You should see a red line on the screen in the main panel- this is the oscilloscope, which will soon be your best friend when things go wrong. This can be used to measure voltage, and see how it changes over time. Let's try it out:
Press this button to turn on the DC power supply. Now, plug two wires into +5 volts and ground of the Power Puck:
Alligator clips can be used to grab wires.
This is the main DC output of the VirtualBench.
Don't worry, this power supply can automatically detect if you touch power and ground together. If you do this, it'll just turn off until you disconnect them.
Here, we can see that it will highlight which part has a short circuit.
Add a probe to channel 1 of the oscilloscope, and one to the function generator:
Make sure the slider on the probe is set to 1x. If it's set to 10x, the function generator may do odd things. We'll use the probe connected to FGEN later, for now just use channel 1.
Now, touch the probe to the wire that's connected to the +6V port. You should see the red line jump up, like so:
Looking at the red underlines, we can see that the scale in the top right is set to 2V per division and the voltage is set to 5V. The red line is 2.5 lines up from the middle line (shown by the little red arrow to the left), indicating that the probe is reading 5V. Using the arrows above and below the volts per division indicator, we can zoom in and out to better see small or large signals. During Sumobots, we won't need to zoom in and out much.
Throughout this workshop, feel free to use the probe to see what voltage the different parts of the circuits are at by simply touching it to exposed connectors.
The small wire with an alligator clip is the ground pin of the probe.
By default, it is tied to the ground of the power supply- so if you're powering your robot off the VirtualBench, there's no need to use it.
Later, when your robot is battery powered, you'll need to clip this to the negative terminal of the battery pack.
Solder some wires to the DC motor following the video below:
You can now connect the VirtualBench power supply to the motor, and it should begin to spin. Reverse the leads, and it should spin backwards. You can change the voltage and see how the motor speed changes. Make sure that you're using the channel marked +6V.
DON'T USE MORE THAN 6v, THIS WILL BURN THE MOTOR
To make a robot move smoothly, we'll often want to set a motor to go at speeds other than fully off or fully on. The easiest way to do this is to simply change the voltage that you apply to the motor.
However, most motor drivers and microcontrollers don't provide any way to do this- they're either 100% on or 100% off. To get around this, we can just turn it on and off really, really quickly- somewhere in the order of 20,000 times per second.
We can adjust how much time we spend on vs off, which is called duty cycle. We can refer to this as a percentage from 0-100. For example: 1ms on followed by 1ms off repeating would be 50% duty, 1.5ms on followed by 0.5ms off would be 75% duty, 2ms on followed by 0ms off would be 100% duty.
As we are controlling on and off times, we refer to this as "Pulse Width Modulation"
For this, we'll use the function generator on the VirtualBench. This allows us to generate repeating signals. In this case, we'll create a square wave between 3.3V and 0V- which is what we'll later generate from the microcontroller. To connect the function generator, use another probe like the one for the oscilloscope. They should also come with caps that allow a wire to be grabbed, which can then be plugged into your breadboard.
However, both the microcontroller and the function generator aren't able to run the motor- the motor needs up to 1000mA of current, and the microcontroller can only provide about 40mA. This is where a motor driver comes in- we can use it as an electrical switch, where our 3.3v signal can control our 6v motor. There will also be next to zero current needed to control the motor driver, so our microcontroller will be kept safe.
Soldering the motor driver will be a little more difficult. If you're new to soldering, pick up a sheet of perfboard from the front and practice like so:
You can see here how the copper surface of the PCB wicks heat away from the solder joint, and briefly causes the solder to resolidify. If this happens, continue to apply heat until you get a good joint with strong contact on both the wire and the PCB.
The leftmost joint is what happens when you only heat the pin and not the board. Next, too much solder- it might creep over onto other tracks. Finally, a good joint with gently curving solder on to the pin.
Now, move on to the motor driver:
Now wire it up like so:
And set up your function generator like this:
Make sure the underlined values are the same.
The main display panel is for the digital oscilloscope, which shows voltage over time. You can use this to see how the voltage flowing through the wires changes over time, giving you an easy way to spot errors and see how the system works. Try probing the wire from the function generator as well as the wires going to the motor- is the voltage to the motors what you'd expect it to look like?
For driving the DC motor, we used PWM to quite directly switch the motor on and off. However, this is not the only use for PWM- it can also be used to transfer data, in this case by Modulating the Width of the Pulses between 1000uS and 2000uS.
Servo motors time how long the pulse is on for, and then go to an angle proportional to the length of the pulse- 0 degrees, for 1000uS, 180 degrees for 2000uS, 90 degrees for 1500uS. Wire up the servo motor as shown in the following:
The brown wire should connect to ground, the red servo wire should be connected to power (between 3 and 6 volts) and the yellow/orange wire should be connected to the function generator.
Please note that PWM is quite an outdated way of sending signals- it's acceptable for basic servos like these and it's simple to use.
For more complex data transmittion, serial data protocols like I2C and SPI are generally needed; we'll circle back to this later on in semester 2, where you'll see how to use these to communicate with drone avionics.
Hopefully you enjoyed our intro session and have had a chance to network with your new teammates!
Next week our session will be on CAD- increasingly, requirements of rapid prototyping is taken as a given for prospective engineering jobs. Knowing how to take designs from Fusion 360 and use a range of machinery to best create a suitable part is an invaluable skill to employers, and there's no better place to learn than the SoE makerspace. Join us next week to get started!
Also, make sure to sign up for PPMS and hand tool training. Failure to do so will expose you to infinite, or near infinite, pain.