I am enjoying watching your experiments. Some interesting concepts.
Day Four: The Six Lab
It’s time to put together a little lab where I can test out all the sensor, LED, and motor, ideas for future Electro Plastic Steampunk machines. The Six offers a good place to experiment. Take off the dome, remove a few of the appendages and you have 12 places to attach EZ bits, which in turn can have a variety of things attached to them.
I want at least:
one solderless breadboard
a place to experiment with the famous 37 Sensor kit
PWM experiment area
ADC experiment area
the ability to drop voltage form 7.4 volts to 5 volts
a camera with horizontal and vertical movement
at least one gripper with horizontal and vertical movement
one pointing finger
A place for 8x8 matrix display
at least one continuous rotation servo
a place for my motor controller for DC motors
I thought I would start by redesigning a new interface and create a project called the Six Lab. This ongoing project can be found on the EZ Cloud (Public, Revolution, DIY, Incomplete) as Six Lab. Here is a picture of my version, preparing to test some LEDs via PWM.
Day Five: PWM Experiments
I enjoy doing visual things with computers and robots, like blinking LEDs and moving gauges. Sometimes the simplest controls offer an opportunity to explore in new directions. How about if I achieve the visual effects simply by means of changing the voltage.
I keep going over the tutorials, looking for new inspirations. while was looking over the lessons and I noticed the PWM control and decided using this as a good place for experimentation. Just by using the PWM control and sliding the slider I can change the voltage to alter LEDs move meters maybe other things. Let’s get started.
What things can undergo visual changes, making interesting robot activity by altering the voltage applied to one or more of the ports? Let's set up a little PWM lab and gather these components:
• RGB LED
• LED VU meter (1349)
• LED voltmeter
• Analog meter
• Multicolored LED
• Blinking LED
• Arduino oscilloscope (.96)
• Green eyed LEDs
• Red light LED
• Fiber optics
• Pulsing LED
• Countdown LED
Pulse Width Modulation is very useful and fun, but I only wish I knew how to change the voltage over a greater range than three volts. Does anybody know how to do that? Anyway, on with all the different things I decided to PWM.
These ideas merit a trip to the dollar store for supplies. I was able to find the fiber optics (a plastic flower with one changing RGB LED, 4.5 volts), the pulsing LEDs (a pair of blinking happy birthday glasses), and the eye-possible LEDs (a cheap reading lamp - one white LED each).
A little cutting and soldering of DuPont cables, and some bending and breaking of plastic and I have three useable PWM experimental pieces.
I use digital ports D3, D4, D5 and D6 for the PWM experiments. Be sure to read the tutorial in the learn section. It is a great start to Pulse Width Modulation.
Here is a photo of the finished project and a video of all the PWM accessories going at once.
Quote:I only wish I knew how to change the voltage over a greater range than three volts. Does anybody know how to do that?
I have a 5v laser diode connected using a 5v regulator to drop the voltage from the 7.4v lipo, and a TIP120 transistor to switch it on and off. I haven't measured the voltage when doing PWM, but I am sure it effectively ranging from 0 to 5v because it is full bright at 100 pwm and off at 0 and moves smoothly between them.
Now of course pwm is not really changing the voltage, it is poweringn on and off very very fast and appears to most devices that the voltage is lower because it is not getting full voltage long enough to come up to full power (or something like that. DJ could explain better). If you view an LED getting less than 100 PWM with the EZ-B (or any digital) camera, you can see that it is actually blinking, but your eye can't see it on its own.
Digital ports logic voltage is 3.3v, the only voltage you get in a port is 0 or 3.3v.
PWM has a specific frequency depends on the Microcontroller timers, when PWM a port between 0 and 100, you are changing the duty cycle.
For example if the pwm frequency is 1 Hz (1 time per second), and your PWM is 25 you will see the LED blinking.
if the pwm frequency is 100 Hz (100 times per second) and your PWM is 25 you can't see the led blinking instead you see it less bright.
Arduinos default PWM frequency is 490Hz, and 980Hz. I have an Arm Cortex M4 and the default frequency is 480 Hz, but it depends on the micro controller clock.
i don't know the EZB PWM frequency and if it varies per version (v3,v4) but my bet is arround 500Hz.
DJ demos the pwm duty cycle:
Thanks thetechguru and ptp for the great comments. They are helpful and appreciated.
Question - what is the simplest way to turn on a 5 volt digital device using the Digital Write Control? I have some 5v circuits on little boards that I just need to turn on and off under EZ Script control. Should I use a transistor switch and power the little board from its own battery or is there a simpler way?
short answer: yes you can use a transistor, but, not all transistors are equal.
e.g. TIP120 can fit in a scenario where you need to control a Motor or a Light.
Good information about how to wire a TIP120 here: http://www.ez-robot.com/Community/Forum/Thread?threadId=3050
However, the thread was polluted somewhat by a troll (Robotmaker). For a while his posts were hidden, so it was both easier and harder to read the thread. They are back in now, but most of what he has to say is useless, so just stick with the first two pages of the thread.
The other option is to use a relay board, but typically you would only need that when dealing with higher voltages.