Quantcast
Channel: AVR ATmega Projects Archives - Projects Tutorials Code Library for Atmels Atmega32 AVR
Viewing all 1082 articles
Browse latest View live

Linkit One Audio Messenger

$
0
0

Have you ever met to this problem that urgently you have to go somewhere and you are try to call your wife or children to tell them about the problem but unable to call them due to some network error. I am sure on some point in life you have met with this type of condition or similar to it. In these case this audio messenger will be a lot helpful to you. It will give your friends or family member your message. I you want to give your family member messages on daily basis then also you can use it. It can also help you to improve your bad habits.

It works on a very simple principle. When any person pass from near to it or obstruct the laser beam, the voice message stored in the SD card is played through linkit one audio jack. To detect motion, a PIR motion sensor as well as a laser checker is used. The reason to use two sensor is that if motion sensor somehow fails to detect motion, laser checker is there to act as a backup plan. The length of audio message is decided by you. You have to save your voice or audio recoding in the SD card by the name “media1”.

For more cool projects, DIYs, electronic information visit and follow my facebook page Frozen solenoid.

PLEASE VOTE FOR ME IN THE CONTEST IF YOU LIKE IT.

Step 1: Gather Parts

Here is the part list of this projects. Everything is easily available at online stores. Laser module can be bought easily from online store. You can buy a speaker or take it out from a old desktop speaker. Here is the list:

PARTS:

  • Linkit one
  • Motion sensor
  • LDR(Light dependent resistor)
  • Laser module
  • Speaker
  • 10K resistance
  • 12V adapter
  • LM386 audio amplifier IC
  • 8-pin IC socket
  • 10K potensiometer
  • 2 X 220uf electrolytic capacitor
  • 2 X 10ohms resistor
  • 2 X 1K capacitor
  • LED
  • 3.5mm audio jack
  • PCB
  • 3V power supply to power your laser
  • A battery for linkit one board
  • A box

TOOLS:

  • Soldering iron
  • A dremel or something by which you can make holes in the box
  • pliers
  • Hot glue gun

MISCELLANEOUS:

  • Ruler
  • A marker
  • Tape

Step 2: Connecting Motion Sensor

When a motion is detected, the horn attached to the linkit one board should start blowing. There are multiple ways to detect a motion but according to me the best way is to use a PIR motion sensor. You can use a infrared led motion sensor but it is not as much accurate in detecting motion as PIR motion senor is. This PIR motion sensor works on the principle of infrared radiation. A human body emits infrared radiation due to heat generated by various organs of the body. A change in infrared radiation trig the motion sensor and output pin of this sensor goes high. This is how a infrared motion sensor works. To know more visit my instructable linkit one sensor tutorial

I made a small shield for my sensor because it is not much breadboard friendly. You can use female to male jump cables but I prefer both side male. Connect your Motion sensor to your linkit one board as follow:

  • vcc of sensor—–vcc of board
  • gnd of sensor—–gnd of board
  • Vout of sensor—–digital pin 8 of board

To check your motion sensor visit my instructable linkit one sensor tutorial whose link you can find above. Copy and paste the code given there. I also ,made a small shield for my linkit one power connector as it has only one vcc and gnd a number of connections to them are more.

Step 3: Connecting the LDR

If a person is at a far distance or by chance our motion sensor fails to detect motion then their should be some backup plan which can detect motion a blow the horn. This laser trigger is for that only. The laser light get scattered a very little therefor it travel a very long distance in a straight path. A laser pointer is used here. The pointer of the laser light is on the LDR and when their is an obstruction in the path of laser light, the output of the LDR become low and the horn starts blowing. The LDR is connected to analog input of the linkit one board. Laser light is powered separately using a 3V battery pack. The circuit diagram is given above or follow these steps to connect your LDR to the board:

  • One end of LDR—–vcc of Linkit one board
  • Other end of LDR——Analog input 0 of linkit one board
  • Short analog input 0 and gnd of the board using a 10K resistor

Connect the positive of the laser light to positive of the 3V battery pack with a switch in between and gnd of the battery pack to gnd of the laser light. Now you need to check what is the value send to your linkit one by
your sensor when laser pointer is on the sensor. To check upload this code code to your board and open serial monitor:

int laser_sensor=A0;

void setup()

{

Serial.begin(9600);
}

void loop()

{

Serial.print(“The value is:”);

Serial.println(analogRead(laser_sensor));

delay(1000);

}

Step 4: Prototyping the Amplifier Circuit

It is good to make the circuit on breadboard before soldering it on perfboard. It helps you to check the circuit as well as parts. If any part is not working properly, it is good to replace it now instead of doing that after you have soldered all the components on perfboard. Prototyping also helps you to memorize the circuit which minimizes the errors while making it on perfboard. For circuit diagram look at the images attache above. Prototype the circuit on breadboard, power on the amplifier and check whether all parts are working properly or not. Replace the part which is malfunctioning. Use the same adapter by which you would power your final products so as to check whether your adapter is capable of supplying the sufficient power to your amplifier or not.

CIRCUIT DIAGRAM GIVEN ABOVE.

Step 5: Soldering the Amplifier Circuit

After prototyping the circuit, its time to make it on perfboard. Fetch a perfboard and start placing components components in it. Solder them properly so that they do not make any problem afterwards. This time do remember to use IC base because in case your IC stops working or malfunctions due to any reason, you can easily replace it. You can even cover your perfboard with white paper before soldering components in it. Be careful while soldering the components. Excessive heating can damage your components.

Step 6: Making a Enclosure

Now its time to make some holes. We would be making a box for our project. Pick up your box and start making the marks with the help of a marker and ruler for the holes of the component . You can use a drill machine to cut holes but a dremel would be better option. You have to make holes for the following things:

  • Motion sensor
  • A small hole from which laser pointer can enter the box
  • A hole for the speaker wire
  • A hole for the adapter jack
  • A hole for the USB cable
  • For a switch

You can cover the box with a white paper or color the box with you favorite color. You can stick stickers on your box to decorate it.

Step 7: Upload the Code

Now this is the time to upload the code to your linkit one board. This is the main step. After uploading the code remove the USB cable from linkit one board. Here is the code and after uploading the code move to the next step where we will hot glue our components with the box.

**********

//Code for audio messenger
//Made by Dushyanta

#include

#include

#include

int motion_sensor=8;

int laser_sensor=A0;

void setup() { Serial.begin(9600);

Serial.println(“Initializing\n”);

LAudio.begin();

LSD.begin();

LAudio.setVolume(10);

LFile rootDir=LSD.open(“/”,FILE_READ);

delay(5000);

LAudio.playFile(storageSD,”media1″);

delay(30000);

}

void loop() { if(digitalRead(motion_sensor)==HIGH) { LAudio.playFile(storageSD,”media1″); } else if(analogRead(laser_sensor)>512) //change 512 from your value { LAudio.playFile(storageSD,”media1″); } delay(50);

}

**********

Step 8: Hot Glue Everything

Heat up your glue gun because its time to stick your components. Don’t skip this step as it is one of the most important steps of this project. You can use double sided tape to stick you board to the box but the better option would be to use a hot glue gun. It will not damage your board. Stick your linkit one board to the box and don’t forget to apply some glue at the point from where the wire is going out to the speaker. Glue the LDR in front of the small hole from where the laser beam would enter the box.

Step 9: Checking

Now its time to check the project. This project requires about 30 to 40 seconds to start. I can make a code which can immediately start the power after the power supply is turned on but the motion sensor used here requires about 30 seconds to work properly. Instead of 30 seconds, I gave a pause of 35 seconds so that there is no chance of motion sensor not working properly. In that gap of 35 seconds we would be checking our sound system. 5 seconds after the power power supply is turned on, the audio file named “media1” will be played. “media1” is the file which will be played when the motion is detected. So the audio file you want to play when the motion is detected should be named as “media1”. If whole message is spoke perfectly, then your sound system is working. After 35 seconds your project will be ready to use. When a person pass from near or obstruct the path of laser light,the audio file “media1” would be played.

Step 10: Done!!

Now use this messenger to give messages to your loved ones. Use it on festivals to give greetings to your loved ones when they pass from near to it. Use it in urgent conditions to give messages.

This is the end of this instructable. Hope you like it. If there is any query, you can comment below or you can mail me or can ask me on my facebook page Frozen solenoid. For more cool projects,follow me. THANK YOU

PLEASE VOTE FOR ME IN THE CONTEST.

Source: Linkit One Audio Messenger


Linkit One Motion Sensor Prank

$
0
0

Do you want to take revenge from your friend or your elder brother because he fooled you on a occasion. Are you searching for something by which you can scare anyone and have fun. If that is the case then you are at the right place. This instructable will tell you how to make a motion sensor prank by which you can scare or fool your friends and family member. It does not use any visual effects to scare people. Only loud sound is used which make this project very simple to be made.

This prank uses linkit one as the micro controller. When any motion is detected, a car or bike horn attached to it starts blowing and then noise made by it surprises the person. To detect motion, this prank uses a PIR motion sensor as well as a laser sensor. It has two sensors for detecting motion so rare would be the case when a motion is not detected by this alarm. PIR sensor detects the motion when their is a change in infrared radiation and turns it output pin high whereas laser sensor detects motion when someone blocks the path of the laser light. In case of motion, a loud horn is made by the horn which scares a person. Hide it is a place where no one can find it and scare people with it.

Please don’t use it a lot because such a loud noise can damage your ears and can also make you partially def. Do not use it on old people. They may get scared a lot and can also get serious. You can get beating from your elders for scaring them. Excessive usage prohibited.

For more cool projects like and follow my Facebook page Frozen solenoid.

PLEASE VOTE FOR ME IN THE CONTEST.

Step 1: Gather Parts

Here is the part list of this projects. Everything is easily available at online stores. Laser module can be bought easily from online store. You can buy a horn either from a car or bike access store or from a online store. Here is the list:

  • Linkit one
  • Motion sensor
  • Relay module or simple relay
  • LDR(light dependent resistor)
  • Laser light
  • Car or bike horn
  • 12V adapter
  • BC547 transistor
  • 1K ohms resistor
  • 10K ohms resistor
  • 1N4007 diode
  • PCB
  • Female header
  • Wire
  • A box
  • 3V battery pack
  • A battery pack to power linkit one board
  • Switch

TOOLS:

  • Soldering iron
  • Hot glue gun
  • A dremel or drill or something why which you can make holes in your box
  • Pliers

MISCELLANEOUS:

  • Ruler
  • Marker
  • Tape

Step 2: Connecting Motion Sensor

When a motion is detected, the horn attached to the linkit one board should start blowing. There are multiple ways to detect a motion but according to me the best way is to use a PIR motion sensor. You can use a infrared led motion sensor but it is not as much accurate in detecting motion as PIR motion senor is. This PIR motion sensor works on the principle of infrared radiation. A human body emits infrared radiation due to heat generated by various organs of the body. A change in infrared radiation trig the motion sensor and output pin of this sensor goes high. This is how a infrared motion sensor works. To know more visit my instructable Linkit one sensor tutorial

I made a small shield for my sensor because it is not much breadboard friendly. You can use female to male jump cables but I prefer both side male. Connect your Motion sensor to your linkit one board as follow:

  • vcc of sensor—–vcc of board
  • gnd of sensor—–gnd of board
  • Vout of sensor—–digital pin 8 of board

To check your motion sensor visit my instructable linkit one sensor tutorial whose link you can find above. Copy and paste the code given there. I also ,made a small shield for my linkit one power connector as it has only one vcc and gnd a number of connections to them are more

Step 3: Connecting the LDR

If a person is at a far distance or by chance our motion sensor fails to detect motion then their should be some backup plan which can detect motion a blow the horn. This laser trigger is for that only. The laser light get scattered a very little therefor it travel a very long distance in a straight path. A laser pointer is used here. The pointer of the laser light is on the LDR and when their is an obstruction in the path of laser light, the output of the LDR become low and the horn starts blowing. The LDR is connected to analog input of the linkit one board. Laser light is powered separately using a 3V battery pack. The circuit diagram is given above or follow these steps to connect your LDR to the board:

  • One end of LDR—–vcc of Linkit one board
  • Other end of LDR——Analog input 0 of linkit one board
  • Short analog input 0 and gnd of the board using a 10K resistor

Connect the positive of the laser light to positive of the 3V battery pack with a switch in between and gnd of the battery pack to gnd of the laser light. Now you need to check what is the value send to your linkit one by your sensor when laser pointer is on the sensor. To check upload this code code to your board and open serial monitor:

int laser_sensor=A0;

void setup()

{

Serial.begin(9600);

}

void loop()

{

Serial.print(“The value is:”);

Serial.println(analogRead(laser_sensor));

delay(1000);

}

Step 4: Making a Relay Module

Here relay is acting as a switch to switch the 5V supply of linkit one board with 12V supply of adapter. We have to do this because all car and bike horns work on 12V and 5V is not sufficient for them. If you don’t have a relay, you can make a circuit using transistors but using a relay is a lot more easier than making a complicated circuit. If you already have a relay module, then their is no need to make it again. Those who are using a 5V relay can also skip this thing but if you have 12V relay then you have to make a circuit for it. The circuit diagram is given above. After making the above circuit here are its connections with the board:

  • vcc of module—–vcc of the board
  • gnd of module—–gnd of the board
  • Vout of the module—–digital pin 5 of the linkit one board

Source: Linkit One Motion Sensor Prank

Portable Solar Auto Tracking System

$
0
0

Medomyself is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to amazon.com

by: Dave Weaver

This build is made with aluminum t-slot extrusion. I chose that material because it is clean, light and great to work with. This could very easily be built with wood but it would not be quite so resistant to UV light and moisture. If you want to see more info on my solar builds than please subscribe to: http://medomyself.com/wordpress/


As long as the earth rotates the Sun will track the sky from East to West. Considering that a solar panel is only producing it’s maximum rated output when it is at right angles to the Sun it stands to reason that those same panels are only producing max power for a very brief portion of the day. These same panels, if turned every few minutes would be much more efficient.

I have been searching for years for a practical and cost effective auto-tracking solar panel but they are not really out there. The ones that do exist are not portable and they are very expensive. So I decided to build my own.

The system I built is a single axis system constructed with T-slot aluminum extrusion, a sturdy set of wheels, a 12 vdc actuator and a manually adjusted inclination. A 50 watt solar panel was used but it can handle up to 100 watts with modifications to the design. It has a solar charge controller, an affordable solar tracking component and an actuator to pivot the solar panel. Simply connect a storage battery to the quick-connect wires and charge your storage battery. If you only require DC power and you happen to use only LEDS to provide light through the evening you would have all that you need. However, most active folks require AC power for radios, TVs, coffee pots and perhaps even a refrigerator. In this case you will want to purchase additional batteries to create an array and connect them to a descent power inverter. Or, you can purchase any number of portable power packs on the market that will combine them in a nice compact and light-weight assembly. The Goal Zero is the ideal power pack for this system.

Materials List:

(1) 50 watt solar panel

(1) 36″ aluminum T-slot extrusion 1″ x 1″

(1) 24″ aluminum T-slot extrusion 1″ x 2″

(2) 10″ aluminum T-slot extrusion 1″ x 1″

(2) 8″ lawn mower wheels

(3) 5 hole T joining plate

(2) Bags 1/4-20 x 1/2″ screw w/ t-nut

(1) 180 deg. pivot bracket

(2) 90 deg. nubs

(1) linear actuator 12 v dc w/ 12″ stroke

(1) solar tracker Home CSP

(1) 36″ length of 1/2-20 all thread

(2) 1/2-20 lock nuts

(2) 1/2″ SS washers

(1) bag of (10) 1/2-20 nuts

(1) 3 hole joining strip

(1) 36″ length of 1/2 cpvc

(1) “J” box of CPVC

36″ of CAT 5 cable or any light gauge 4 stranded copper wire

Tools required

(1) 11/64 drill bit

(1) 1/4-20 tap

1/4-20 hand tap

3/16″ T – wrench

crescent wrench

wire strippers

wire nuts

electrical tape
more details medomyself.com

Step 1: Assembling the Mast to the Base

The first step is to mount the mast with the base. The mast is 36″ @ 1″ x 1″ T-slot extrusion. The base is 24″ @ 1″ x 2″ T-slot extrusion. They are connected together with a 5 hole bracket, also manufactured by 80/20.

Place (4) 1/4-20 screws into the bottom row of the 5 hole bracket, and (3) screws with t-nuts on the top row of the same bracket. Do not tighten yet. Slide the 3 holed side of the bracket onto the mast. Slide the 4 hole side of the bracket into base. Position the bracket so it is in the middle. Tighten the 4 screws on the bottom and then seat the mast firmly down against the base with your T wrench. Tighten the 3 remaining screws.

Step 2: Installing Axle Through Base

Now take the section of all-thread and place it through the center hole of the base. You will need approximately 4″ extending from each end to allow for the wheels to have enough clearance. Place a 1/2 washer on each end and then thread on a 1/2-20 nut on each end. Tighten them fully.

Now take a wheel and place it on the end of the axle as shown. Thread on a 1/2-20 lock nut on each end. This is not a Ferrari, the wheels should have a little play and they should spin freely.

This completes the base.

Step 3: Installing the Actuator Arm and Foot

The bottom portion of the mount is made up of (2) 10″ sections of 1″ x 1″ extrusion. One section is connected to the mast, the other is mounted on the 180″ pivot bracket and serves as a leg. This is where you will adjust the inclination.

The T bracket shown in the photo is no longer used, instead I use a 5 hole T bracket (same ones that will be mounted to the solar panel). Install screws and t-nuts on the bracket and slide down the mast as shown, approximately 10″ off the ground. Tighten the 3 screw on the mast side. Now slide (1) of the 10″ sections of 1″ x 1″ onto the (2) hole side of the bracket and tighten.

Take the remaining 10″ section of extrusion and install the 180 degree pivot bracket as shown. The turn knob and carriage bolt must be disassembled prior to installing. The 10″ section for the leg needs to be tapped on one end only. The 90 degree nub threads into the tapped section of extrusion.

Step 4: Installing Brackets for Solar Panel

This step requires you to drill holes in the outside frame of the solar panel. Place one of the 5 hole brackets on the top of the solar panel and mark where the holes are going, this should be in the middle of the panel. Do this for the bottom also. Drill (2) holes, the 2 outside holes, with an 11/64″ drill bit. After the holes are drilled swap out the bit with the 1/4-20 tap and tap the holes. You will not need lubricant for these taps.

Take the (2) remaining 90 degree nubs and install them on the mast as shown. These should be spaced to match the distance between the two brackets. At this point you have two options, you can insert one of the 1/4-20 hex head screws into the solar panel bracket and into the nub. You can do this for the top and bottom. The alternative is to thread 2 small sections of 1/4-20 all-thread, about 1.5″ long with lock nut a plastic spacer into the nub. This allows you to slip the panel on and off easily.

Step 5: Installing the Actuator and Hardware

Now install the 3 hole joining strip at the end of the 10″ extrusion that extends from the mast. Install 2 button head screws and 2 t-nuts to secure it but leave the last hole vacant.

The actuator comes with mounting hardware. The angled cylinder bracket should be installed on the left side of the solar panel as shown using the same techniques for the solar panel brackets. One end has a wing nut and the other end is pinned.

Take a 2″ long 1/4-20 bolt and pass it through the vacant hole on the joining strip and thread on a 1/4-20 nut to secure it. Place a nylon 1/4″ tall spacer on the bolt,this will cut down on friction. Now thread on the the 1/4-20 wing nut on the bolt to secure actuator on one end. Install the actuator bracket on the solar panel and pin the travel rd of the actuator.

The actuator must not bind and it must travel the full arc. This will be tested later.

Step 6: Installing the Solar Tracker and Junction Box

The sensor is mounted on the end of the 1/2″ CPVC pipe. The sensor has (4) wires, battery plus, battery minus, CW & CCW for the actuator. The small junction box is mounted 3/4 of the way down the CPVC and another short section of CPVC extends out the bottom of the junction box, enough to reach to the bottom of the solar panel outer frame. This assembly is secured to the solar panel using pipe clamps. The wires will enter from the bottom and exit out the side to the controller and to the top into the sensor.

The solar tracker I used is manufactured by Home CSP. I have used the Tiny Tracker with all of the systems I have built and I have never had a problem. I certainly recommend using one for your system.

Step 7: Wiring the Components

As for wiring your solar tracker you have a couple options. If you are using a 50 watt solar panel and your intent is to charge a large deep cycle storage battery that is in a power pack like Xantrex or by itself then simply connect as shown.

Anderson quick connectors are used to connect everything. Because this is only a 50 watt solar panel it does not produce very much current (< 3 amps), so a small 7 amp charge controller will be just fine. I chose to install this on the back of the solar panel with silicon but it would be better to use the charge controller that is built into some of the more common power packs.

Step 8: Final Preparation and Test

The power pack in the photo is just something I put together. I wanted a much lighter power pack that could be daisy-chained with other battery packs to increase the storage capacity. I used a battery box with an LED charge indicator. Instead of using a heavy lead acid battery I used a LiFePO4 20 AH battery. I put an 800 watt modified power inverter in the bottom with a remote control mounted on the front of the box. It only weighs about 15 pounds.

In the adjacent photo you will notice that I am using a 12 vdc cigarette power socket to convert to the anderson connectors. I also use a “Watts Up” meter to measure the charging current…nice to have.

When power is first applied the actuator will jog West then East and stop, after a few moments it will start to seek the Sun. From that point on the tracker will sample the light every 3 minutes or so. This process will repeat itself until sunset. At night it will go back to the East and set.

Install the long turn-knob w/ 1/4-20 stud. You will need to tap the end of the mast to install this.

Test Travel Of Actuator

This mount has no limit switches, the linear actuator has them built in, that is why you must ensure that the solar panel can travel about 180 degrees from East to West when facing due South. If the panel binds or does not travel enough loosen the 1/4-20 hex head screws that hold the 3 hole joiner strip and slide in or out to increase or decrease the travel. Retighten.

Step 9: Operation

Operation

The bottom leg of the mount needs to be folded out of the way for safe transport. To do this loosen the black turn-knob and fold the 10″ bottom leg flat toward the mast. Re-tighten the knob.

Move the solar mount to an area with a clear view of the southern sky. Position the handle on the mast so that it is facing due south. Connect the power pack to the solar mount.

Loosen the bottom turn knob and tilt the mount to match the Sun’s approximate angle. Tighten knob. Soon your panel will start to track on it’s own.

For more details and other builds:

https://www.etsy.com/shop/BuildFromPlans

http://medomyself.com/wordpress/

Attention – Coming in Jan. 2016 – Portable Solar Tracking Mount

In the first week of January 2016 we will be introducing a

complete solar tracking system for those of you that don’t want to mess with building one from scratch. We will be launching a single axis solar tracker that will handle a solar panel up to 100 watts. It will include:

50 watt solar panel

Solar Charge Controller

12 vdc actuator

Solar Tracker

Universal mount (handle up to 100 watt panels)

Wheeled portable dolly

Auto Single axis (azimuth)

Mechanical (inclination)

Source: Portable Solar Auto Tracking System

Simon Says With LinkIT ONE

$
0
0

Let’s go through a classic beginner projec that combines circuits, code, and fun: Simon Says. Building your own Simon Says game can be a great way to quickly dive deep into the awesome world of tinkering. You get experience with building some simple circuits (buttons and LEDS) and also some exposure to code that can border on advanced at times. Grab a LinkIT ONE and let’s get started!

Step 1: Supplies

Even though this a beginner project, we’ll need quite a few things. Don’t worry though, all of these things are relatively simple to find at Sparkfun or your local electronics store.

  • LinkIT ONE Board
  • Red LED
  • Green LED
  • Blue LED
  • 330 ohm resistors (3x)
  • Buttons (3x)
  • Grove Buzzer
  • Jumper Wires
  • Breadboard

Step 2: Hooking Up Your Circuit

Next, we’ll need to hook up our button and LED circuit. This is a fairly simple circuit that combines elements of a basic button, and of an LED.

Remember, a button circuit looks for a ‘HIGH’ signal, AKA, that the circuit is actually completed (which happens when you press a button down. For more info, check out the this resource.

The LED is a basic circuit, and only lights up when we send a high signal. Including a 330 ohm resistor in between is a good idea. This prevents you from overloading your LED and burning it out.

Set up the circuit just like the diagram and picture above!

Step 3: Hooking Up the Buzzer (Optional)

I added a Buzzer with my Grove Buzzer just because I had it laying around and I thought it would add a fun extra element to the game. You’re in no way required to do so, and not doing it won’t affect your game at all.

That being said, a buzzer adds a pretty cool element to the game. I had it buzz when users failed, and also when users won. Audible feedback can make it really fun!

All you have to do for this step is hook up the Grove sensor to one of the Grove pins on your LinkIT ONE. This is one of the great things about the LinkIT ONE, you get grove slots baked right in! How awesome is that?

Step 4: Deploying the Code

Now for the tough part. The code for this project can balloon in complexity quite easily. Yes, it really is just a bunch of button and LED logic, but adding in the random generator (along some something to store it) can get difficult quickly.

In the interest of making this a simple guide, rather than a full out textbook, let’s treat the code as a bit of a black box for now. The code we will use is based off of code from a Sparkfun Repo, so it is very well commented and easy to understand. Hopefully reading through it, you are able to pick up on what exactly is going on. Take note that modifications have been made in order to make it work on the LinkIT ONE.

Download the code and deploy it to your LinkIT ONE.

Step 5: Completion!

You’ve done it! You now have a fully operational Simon Says Game to play with!

I Really think the best part about this project is that it combines a lot of great electronics and code together to form a great beginner project for people interested in tinkering. Hopefully this project has provided that you and given you a great platform to go forward on! Happy Making!

Source: Simon Says With LinkIT ONE

Home Automation – RC Lighting

$
0
0

Is there an appliance in your house that you wished could be turned on easier? That hard to reach light that you need every day or a fan? With the LinkIt ONE we can do just that! Specifically we can control an AC appliance with a remote control! There are many different appliances around the house that this would work for. There are also many different ways of automating your home. I chose to use an Infra-red remote control.

Do I have to have a specific remote you may be wondering? No! Any and every infra-red remote will work. In the code I made the IR receiver look for any infra-red signal. Once, received it turns the light on.

How does it work? The LinkIt ONE is programmed to listen for infra-red signals. If it gets one, it will then activate a relay which will then turn on the light. Because we are dealing with AC voltage we cannot simply use a digital pin directly. Thats where the relay comes in. A relay is basically a switch capable of switching on and off high voltages with small voltage inputs.

WARNING: I am not responsible for any harm that you experience because of this instructable. High voltage is dangerous! Straight from Wikipedia, “Voltages greater than 50 V applied across dry unbroken human skin can cause heart fibrillation if they produce electric currents in body tissues that happen to pass through the chest area.[citation needed] The voltage at which there is the danger of electrocution depends on the electrical conductivity of dry human skin. Living human tissue can be protected from damage by the insulating characteristics of dry skin up to around 50 volts. If the same skin becomes wet, if there are wounds, or if the voltage is applied to electrodes that penetrate the skin, then even voltage sources below 40 V can be lethal.” U.S. homes have voltages of 220!

Also, I want to upfront apologize for any blurry pictures! Sorry about that!

Now that I have scarred you, lets get started!

Materials

Step 1: Picking Your Appliance & More Safety

In order for the following steps to be helpful I suggest you try this on a light first. I will demonstrate the method using the light part of a ceiling fan. Basically anything that has a switch in it to turn it on/off will work. Even if it does not have a switch you can do this by cutting one of the wires and putting our project in between.

The best way to work safely is to cut the power to your appliance. If it is something you plug in the wall that is easy obviously. If it attached semi-permanently like a ceiling fan then it is a little harder.

The best thing to do in that case is flip the breaker. If you are not sure which one it is then you will have to do some guess work. First power down all computers that rely on external power. Then turn on the appliance you are working on. Have someone tell you when it turns off as you try different ones. Hopefully yours are labeled and you won’t have to do this. Another precaution is to where some sort of insulation such as gloves.

Step 2: Tools

Obviously everyone’s tools will be different but here are some things you will need regardless of what type of appliance you are working on.

  • Electrical Tape or other insulator
  • Wire Cutters
  • Screw Driver
  • Knife/Razor
  • Flashlight
  • Wire

If you are working in a windowless room or an otherwise dark area a flashlight is a must. The electrical tape is for insulating any wires we cut. You could also use wire nuts, duct tape, or even heat shrink if it is sufficiently large. Wire is useful if you have to extend a wire you cut. Make sure you get a gauge of wire that will withstand AC current.

Step 3: LinkIt ONE Enclosure

You will want some sort of box to cover up the electronics part that you are adding so it does not look too messy. I used a plastic box. On one side I made a rectanglish hole for the IR receiver and on the other side I made a small hole for the relay wires. Make sure there is room for the battery that came with your board to fit.

The wire I used for the IR Receiver is from an old servo that I thought was broken when I cut it, but that’s a different story. It worked perfectly for its new purpose. I had to bend the jumper wires so I could fit the lid on but that was OK with me.

Step 4: Code

The code is very simple. All it does is wait for a signal and then turn the light on/off depending on what its current state is.

However, initially getting the remote to work was a pain. The traditional IRemote library will not work because it cannot compile on the LinkIt ONE. So I searched and found a library specific to the board. Download it and install it in your IDE. Now you can use infra-red receivers. Apparently, it only works on digital pin 2 and that is what I have wired the receiver too.

I also had a problem with the library after installing it. In the main loop, once I pushed the button once it would continue to turn the light on and off, on and off. I had no idea why because the if function checked for a signal before it was executed and then did it only once. I finally found out that I needed to so called flush out the old received value. Once I added that it worked perfectly at first! I also added a delay of 5 seconds after you press the button because it keeps extra button presses from effecting the state of the light. Also, it is probably not that good for the light-bulbs to be turned on and off very quickly.

The reason I say at first it worked is because after being installed for a while it started turning on/off randomly. I had it installed in my bedroom and in the middle of the night it turned on, off, on, off. Ahhhhhhhhh! What is it doing!! I then realized that since I had made the code accept any infrared value that the light bulbs on the fan were effecting it because they emit infra-red light! So i added a little duck tape filter that focused the receiver so it would only be able to get signals from a certain direction. It worked!

So upload the code provided and make sure first that the library is installed.

Step 5: Disecting the Fan – Accessing the Electronics

Above you can see our unfortunate victim of experimentation.The chain coming out will be replaced with our contraption. On my fan, I only had to remove two screws. Lay them aside along with the cover in a safe place. Then remove the fastener by the chain that holds the switch in place.

Step 6: Disecting the Fan – Removing the Switch

Now, pull out the switch and trace each wire. If there is one that leads to a wire nut then unscrew it and remove that side. You will have probably have to cut a wire unless both ends terminate at a wire nut. Make sure to leave all the other wires in the wire nut at the same place.

My apologies for the bad pictures. I had to take them in the dark while holding a flash light because the room did not have power.

Don’t cut the wires right at the end or you will not be able to put the other piece back if something goes wrong. Use the pictures for reference.

Step 7: Preparing for Installation

If there were wire nuts than you will need to add an extra wire since you took the switch out. Cut a piece of wire and strip half an inch from both sides. Now unscrew each wire nut and put the new wire in. If there was no wire nut and you had to cut the wire then check the length. If it is too short than cut another wire following the same process and twist it together with the old end. Wrap the connection with electrical tape for insulation.

Step 8: Installing the Relay

The relay we are using has two sides with three ports on each side. We want the side with the curvie lines. See the pictures above. Looking at the relay upside up we will be using the two right slots. Push the two wires in from the last step, order does not matter, and screw them down.

On the other side we will install the wires for the input. First wire them through the hole that used to house the switch. Screw down the 3 wires to the other side. From left to right it goes 5v, Signal(pin 13), and ground. Once you have them through the hole, put them through the circle hole in the box and then plug them into the board. Make sure you plug Vcc into 5v and not 3.3v. It is a 5v relay. It only accepts 3.3v logic.

In the pictures follow the jumper wires, not the servo wire.

Source: Home Automation – RC Lighting

Door Open Alarm With Linkit One

$
0
0

This is a device that indicates by buzzing whenever the door crosses the specified distance giving a red light indication.This has been developed by linkit one board received in the giveaway! Its total cost is ~63$ including ~60$ linkit one board.Here’s video of it in action :-

https://youtu.be/SbazZ44E9QY

Step 1: Things Required

We need:-

  1. Linkit one
  2. USB cord
  3. 8 Jumper wires (male to female)
  4. L.E.D red
  5. L.E.D all except red color
  6. Buzzer
  7. Battery (optional)
  8. Hc-SR04 ultrasonic distance sensor

Step 2: Connecting Jumper Wires

We need 8 jumper wires ,connect them all to the male ports of sensor ,leds and buzzer.

  1. Connect positive terminal of red l.e.d to digital pin 11 and other to gnd
  2. Connect + terminal of other led to digital pin 10 and other to gnd
  3. Connect +ve terminal of buzzer to digital pin 9 and other is to be taken common with red L.E.D’s negative as we have less gnd ports.
  4. Connect echo to digital pin 12
  5. Connect trig to digital pin 13
  6. Connect Vcc to +5 pin (positive supply)
  7. Connect gnd to gnd (negative)

Step 3: Code

This is the sketch of it.

Some code and wiring inspired by http://en.wikiversity.org/wiki/User:Dstaub/robotcar */

#define trigPin 13 #define echoPin 12 #define led 11 #define led2 10 #define buzzer 9

void setup() { Serial.begin (9600); pinMode(trigPin, OUTPUT); pinMode(echoPin, INPUT); pinMode(led, OUTPUT); pinMode(led2, OUTPUT); pinMode(buzzer, OUTPUT); }

void loop() { long duration, distance; digitalWrite(trigPin, LOW); delayMicroseconds(2); digitalWrite(trigPin, HIGH); delayMicroseconds(10); digitalWrite(trigPin, LOW); duration = pulseIn(echoPin, HIGH); distance = (duration/2) / 29.1; if (distance < 50) { digitalWrite(led,HIGH); digitalWrite(buzzer,HIGH); digitalWrite(led2,LOW);

}else { digitalWrite(led,LOW); digitalWrite(buzzer,LOW); digitalWrite(led2,HIGH); } if (distance >= 200 || distance <= 0){ Serial.println(“Out of range”); } else { Serial.print(distance); Serial.println(” cm”); } delay(800);

Step 4: Making Enclosure

Make a small box in which the setup can fit easily and then insert all the components to the box holes and also paste an instructables robot sticker from your pile.

Step 5: Test!

Test it by using battery or simply use charger output that is too 5 volts! Check if buzzer and red led are working simultaneously and also if the white l.e.d turns ON whenever there is noting in between.If it is OK,then congratulations! The l.e.d s may appear a little dull that’s why I used a dark place for demonstration!

Step 6: Done!

Stick it on the wall adjacent to door of room which you think has important valuables in it.You can change the distance of reaction by changing the value of 50 in the code.It is in cms.You can check the distance in serial monitor giving an estimate of it.

I hope you enjoyed!

Thank you!

Source: Door Open Alarm With Linkit One

Energy Saving Switch With Presence Sensor

$
0
0

Do you face such situations when you leave your reading lights, table fans or soldering irons without switching them off and later realize that they were on for too many hours which subsequently jumps off your electricity bills? Well, if you have such a problem of forgetting things which probably most of you would have (including me :P), you have just found the right thing! This project will detect your presence on your work chair and then switch on and off appliances connected to it accordingly.


The project uses an ultrasonic sensor connected to the Mediatek Linkit ONE as it’s brain. By detecting the distance from the sensor to your chair, it can detect your presence as the distance will decrease when you are sitting on the chair. The relay connected to linkit one gets activated when you are sitting on your chair thus switching on the appliance while it switches it off as you leave. Thus, this project will greatly help to reduce your electricity bills as any appliance from soldering irons and hot glue guns to lights and fans can be controlled using this appliance.

The project is not very complicated and easy to make thus can be a good way to start with linkit one. There are innumerable number of modifications you can make to this project. Remember to post a feedback in the comment section below. Do post the pictures of your own project if you’ve made one yourself. Don’t forget to follow for more great projects!

For more cool projects, videos and facts, like my new facebook page – Frozen Solenoid

Step 1: Parts and Tools

The following parts and tools are required to make this project. The total cost was around $70 or 4200INR. If you already have a linkit one or got it from the giveaway recently, the total cost will be reduced to $10. No complex are required so you can buy all of them online.

PARTS:

• 1x Linkit ONE
• 1x Lithium battery for powering the board
• 1x Ultrasonic sensor
• 1x 3v or 5v Relay
• 1x BC547 transistor
• 1x 1K resistor
• 1x Screw terminal
• 1x 5v USB adapter
• 4x Male to female jumper wires
• A suitable enclosure for your project
• Perfboard
• Rainbow wire

TOOLS:

• Soldering iron
• Soldering wire
• Hot glue gun w/glue sticks
• Wire cutter/stripper
• Pliers
• Drill

Step 2: Connect the Ultrasonic Sensor

The very first step in the building process is to connect the ultrasonic sensor to the linkit one board. The sensor here serves the main purpose of the project, that is calculating the distance. As most of you would already know, my transmitting ultrasonic waves and then receiving the reflected ones, an ultrasonic sensor is able to calculate the distance of the obstacle present in front of it.

Here, this sensor will be used to detect your presence. There is no kind of a human sensor present which will be used but your presence can be detected by using simple logic. When the sensor will be kept at your workbench facing your chair, the distance would be more when you are not sitting on your chair while it would be comparatively less when you are sitting. So when the distance becomes less that the set threshold, the board processes the signal of the sensor and activates the relay which switches on your appliance. Understanding all this would be easy until you make it difficult yourself as there rocket science involved in this project.

Connect the sensor to linkit one using some male to female jumper wires according to the following:

1. Vcc —- Linkit one’s 5v
2. Gnd —- Gnd
3. Trigger —- D2
4. Echo —- D3

Step 3: Make the Relay Board and Connect It

The aim of the project as told earlier was to switch on an appliance during your presence. Now to give power to something, you can’t just take the output from one of the digital pins on linkit one as their output current is too less to power something. So the trick used here is to power a relay from the digital pin (a relay is a magnetic switch which on receiving a weak signal, closes it or switches it on). So, when the sensor detects your presence, the digital pin gives a weak signal to the relay which then switches on the appliance it is connected to.

The output current of linkit one is not enough even to power a relay you there is a need to use an external transistor. Since we want our appliance to be switched on when the output is high, we would be using Pole and NO pins of the relay. On receiving a high output, these two pins get connected thus closing the switch.

An important thing to consider while using a relay is the voltage and the current ratings. Voltage rating is the minimum voltage that is required to activate it while current rating is the maximum current that the Pole, NC and NO pins can handle. Here I have used 3V, 3A relay. You can also use a 5V relay but higher than that would not work. Power rating should not be less that 2A. It should be more that 5A if you want to power any AC appliance.

For connecting the relay, first you need to solder everything to a piece of perfboard and then connect it to linkit one. Refer to the schematic for the same. You need to solder a screw terminal to connect the wires which will then be connected to your appliance.

Step 4: Upload the Code

Upload the code given in the ino file given below to your linkit one. Make sure that the on-board switches 1,2 and 3 should be in UART, USB and SPI positions respectively before uploading the code.

If you have never uploaded a code to your linkit one, you can follow my Linkit ONE Getting Started Guide for setting up your board for the first time.

Note:

1): You need to download the NewPing library before compiling the code else it will show a compilation error.

2): Change the threshold distance according to your requirement. First calculate the distance between your chair and the place where you will keep the device in cms. Then set the threshold at a little less distance than your calculated one.

#include
int threshold_dist = 50; // Change the threshold distance according to your requirement
NewPing sonar(2, 3, 400);

void setup()
{
Serial.begin(9600);
Serial.println(“Ready!”);
pinMode(4, OUTPUT);
digitalWrite(4, LOW);
}

void loop()
{
unsigned int uS = sonar.ping() / US_ROUNDTRIP_CM;
Serial.print(“Distance: “);
Serial.print(uS);
Serial.print(“cm”);
Serial.println();

if(uS >= threshold_dist)
{
digitalWrite(4, LOW)
Serial.println(“Current State: OFF”);
}
if(uS < threshold_dist)
{
digitalWrite(4, HIGH);
Serial.println(“Current State: ON”);
}
delay(500);
}

Step 5: Connect the Battery and Mount Everything Inside an Enclosure

After uploading the code, connect the lithium battery provided with the board to the female socket present at the bottom left corner of the board. Slide the switch to BAT position and you should see the on-board LEDs light up.

Now hot glue everything inside a proper enclosure. The best option can be to use a plastic drug case which is very easy to work with but there are a variety of other options you can use as well. Make sure that the ultrasonic sensor should be vertically facing towards you when the box is kept still. Hot glue the sensor to a height so that it can easily detect your presence.

Lastly, protect all the wires with some insulating tape.

Step 6: Connecting to an External Power Supply for Long Use (Optional)

If you want to use this device for a long period of time, unfortunately the battery wouldn’t last for more than 2 or 3 hours. The solution to this problem is to use a simple USB charger or a wall wart for uninterrupted power supply.

For this, first disconnect the battery from your linkit one. Then connect a USB charger to it using a micro USB cable. Slide the switch to USB position and you should see the on-board LEDs light up.

Step 7: How to Connect to an Appliance?

Now you’re all done with the building process of the project. The last step left is to connect this project to the appliance you want. As told already, the relay will act as a switch and will close it on detecting your presence. So to connect an appliance to this device, you just have to do the same that you do to connect something with a switch. Instead of connecting two wires to a switch, you have to connect those wires to the relay pins (NO, Pole).

First take two long pieces of wires and connect them to the screw terminals that you soldered earlier. The wires should come out of the enclosure. Now you can’t just connect these wires to any appliance. You have to consider a few things before connecting something.

Firstly, you should consider the current rating of your relay. Powering small DC appliances should not be a problem but when it comes to AC appliances, you should be cautious. Ofcourse you cannot power big appliances like air conditioner and room heaters (the rating should be more than 15A). For small ones like table fans, desktop lamps, 3-5A relay can be used while you can power only DC appliances with any relay with current rating less than 2A (you can still power big ones but with the risk of burning the relay terminals). You should also check whether the terminals can handle AC current or not. It is always better and safe to use higher power relays. The voltage rating should also be more than what is supplied in your house.

The image above shows the device first connected to an LED, then a 12V CPU fan and finally a 10W AC bulb. You can follow the schematic given above for making the connections.

Step 8: You’re Done!

So you’re finally done with one more linkit one project! Your electricity bills would now be reduced to a certain extent now! But that’s not the end. You can try an experiment with different threshold distances or extend the project by adding more features to it. One of the ideas can be to use a higher power relay to power big appliances. You can even experiment with different sensors.

This brings another instructable to an end. Hope you liked it. Remember to leave a feedback below. You can also post your own ideas, modifications or mistakes in this project in the comment section below. I would really appreciate it. If you think that this project was good, you can vote for me in the only contest this instructable is entered in.

Don’t forget to follow for more great projects!

For more cool projects, videos and facts, like my new facebook page – Frozen Solenoid

Thanks for watching 🙂

Source: Energy Saving Switch With Presence Sensor

DIY ESP8266 ESP-12 Socket – Snap Fit, Breadboard Friendly, No Soldering

$
0
0

I’ve been looking for an ESP8266 (ESP-12) socket for a long time, and the way I see it, It had to have all of these properties:

  • 100% Breadboard Friendly
  • No soldering required
  • Snap Fit and snugly hold the ESP8266
  • DIY from everyday household items
  • Easy to print
  • Easy to build

I found a few solution on Thingiverse.com, But non of them met all my prerequisite, so I designed my own socket.

The socket turned out very good and the design met all my expectations and conditions, in addition it has a cool ‘Spaceship‘ look.

Supplies:

  1. 3D Printer (I used my Creality Ender 3 V2)
  2. Pliers
  3. Cutter
  4. #2 Paper Clips

Step 1: 3D Print

I designed the Socket using Autodesk Fusion 360 Personal and I highly recommended it – About 4 hours.

I 3D printed the model using my Creality Ender V2 – About an hour.

Slicing for the Ender 3 V2 was done using Cura with the basic settings, nothing special:

  • 20% Infill
  • 0.2mm Layer Height
  • No Raft
  • No Support

Step 2: Assemble the Pins

My biggest challenge was to make the pins stay in place between uses, while inserting and removing the ESP8266 and while connecting the socket to breadboards, in addition I didn’t want to use glue or more 3D parts (casing and brackets) to keep the pins in place.

After several designs I came up with the solution – a tiny groove at bottom to fix the pin, together with the upper bridge, this design keep the pin in place by countering the upward\downward motion while using with breadboards and fitting the ESP.

The assembly is quite easy and straight forward once you get it, take a look at the animation and the video above to get a better idea.

For each pin:

  1. Open a paper clip to a straight wire
  2. Insert the wire to the inner hole (the short one)
  3. Leave enough wire for the bottom grove (don’t bend it yet)
  4. Bend the upper part, use the top groove as guidance
  5. Use a marker to mark the outer hole (the long one) position on the wire
  6. Take out the wire and bend accordingly
  7. Insert the U shaped wire all the way down
  8. Flip the socket on a table or a flat surface
  9. Pull the outer pin to make it flash with the top part
  10. While pulling the inner pin, bend it half way through toward it’s grove
  11. Cut any excessive material (Be carful, it can shot out – USE eye protection and pay attention to the cutting direction and projectile)
  12. Bend it all the way and fix it inside the groove

For ease of assembly, start from the left side, the nose of the ‘spaceship’ and work your way to it’s engines.

Finally, trim all the pins to about 10mm.

Step 3: Quality Check and Usage

Plug an ESP8266 to the socket and using a multimeter perform a continuity test for each pin, touch the pin with one end and the gold headers on the ESP with the other end, make sure you don’t accidently touching the pin wire.

When you plug the socket to a breadboard, apply force evenly and make sure you press down on the pins for added stability and to keep them from bending out.

My entire motivation for this project was to be able to program the ESP-12 module using a NodeMCU and doing so without any soldering, you can find more about this method here, now I can easily achieve this using my new socket.

Step 4: What’s Next?

The first thing I’ve noticed is that the paper clip wire is a bit thick (0.8mm), I believe using a 0.6mm copper wire will be easier on your breadboard and make it less tight when plugin in the ESP.

I hope I can test it soon and upload my results.

Source: DIY ESP8266 ESP-12 Socket – Snap Fit, Breadboard Friendly, No Soldering


Wakeup Light

$
0
0

As I write this instructable it is mid winter on the Northern hemisphere and that means short days and long nights. I am used to getting up at 06:00 and in the Summer the sun will be shining by then. In the Winter though, it gets light at 09:00 if we are lucky to have a day that it isn’t cloudy (which is…not often).

Some time ago I read about a “wakeup light” made by Philips that was used in Norway to simulate a sunny morning. I never bought one, but I kept thinking about making one because making one yourself is more fun than just buying it.

Supplies:

Picture frame “Ribba” 50 x 40 cm from IKEA

perforated hardboard from hardware store

STM8S103 development board via Ebay or others

DS1307 Real Time Clock (Mouser, Farnell, Conrad, etc)

32768 Hz watch crystal (Mouser, Farnell, Conrad, etc)

3V lithium coincell + coincell holder

BUZ11 or IRLZ34N N-channel MOSFETs (3x)

BC549 (or any other NPN transistor)

as many white, red, blue, green, etc leds as you want

some resistors and capacitors (see schematic)

Powerbrick, 12V to 20V, 3A or more (e.g. old laptop powersupply)

Step 1: Making It (a Little) Easier to Get Up

The idea is that it is hard to get out of bed in the morning when it is still dark. And if you live close or even above the arctic circle it will be dark very long. In places as Tromsö in Norway it will not get light at all as over there the sun sets half November only to re-appear halfway Januari.

So what Philips did was simulate the rising of the sun.

Philips slowly increases the brightness of a the lamp, which is probably made with several leds but hidden behind a single diffuser. Their time from off to full brightness takes 30 minutes.

The Philips wakeup lights aren’t that expensive but it has just a single colour and it looks a bit small. I think I can do better.

Step 2: More Colour

My wakeup light uses four colours, white, red, blue and green. First
come the white leds, then come red ones, and last a few blue and green leds. My idea was that I could simulate not only the increase of brightness but also the shifting of the morning light colour, by starting with a bit of white, adding in red a bit later and mixing in blue and green in the end. I’m not sure that it actually does resemble actual morning light, but I like the colourful display as it is now.

Mine is also faster than the Philips wakeup light, instead of the 30 minutes of the Philips light, mine goes from 0% to 100% brightness in less than 5 minutes. So my sun rises much faster.

NOTE:

It is VERY hard to make pictures of my wakeup light, I tried with several camera’s and smartphones but all pictures I made do not do the real thing justice.

Step 3: Sigmoid Curve, Flickering and “resolution”

Of course I wanted to make the brightening as smooth as possible. Human eyes are logarithmic in sensitivity, meaning that in total darkness they are more sensitive than they are in full daylight. A very small increase in brightness when the levels are low “feels” the same as a much bigger step when the light is at say 40% brightness. To achieve this I used a special curve called Sigmoid (or S-curve) this curve starts as an exponential curve that halfway levels off again. I found that it is a very nice way of increasing (and decreasing) the intensity.

The clock frequency of the microcontroller (and the timers) is 16 MHz
and I use the maximum resolution of TIMER2 (65536) to create three pulse width signals (PWM). Therefore pulses come 16000000 / 65536 = 244 times per second. That is far above the limit of the eyes to see any flickering.

So the leds are fed with a PWM signal that is made with this 16 bit
timer of the STM8S103 microcontroller. At minimum this PWM signal can be ON is 1 pulse length long and the remaining 65535 pulse lengths off.

So the leds connected to that PM signal will then be ON 1/65536-th of the time: 0.0015%

At the maximum they are ON 65536/65536-th of the time: 100%.

Step 4: Electronics

Microcontroller

The brain of the wakeup light is a STM8S103 microcontroller from STMicroelectronics. I like to use parts that have just enough capabilities for a job. For a simple task as this it isn’t neccessary to use STM32 microcontrollers (my other favorites) but an Arduino UNO wasn’t enough as I wanted three PWM signals with 16 bit resolution and there is no timer with three output channels on an UNO.

Realtime Clock

The time is read from a DS1307 real time clock that works with a 32768 Hz crystal and has a 3V backup battery.

Setting of the current time, day and the wakeup time is done with two buttons and shown of a 16 x 2 LCD character display. To keep my bedroom really dark at night, the backlight of the LCD display is switched on only when the leds are brighter than the backlight and when you are setting the time, day and wakeup time.

Power

Power comes from an old laptop power supply, mine produces 12V and
can deliver 3A. When you have another power supply it may be necessary to adjust the resistors in series with the led-strings. (See below)

Leds

The leds are connected to the 12V supply, the rest of the electronics
works on 5V made with a 7805 linear regulator. In the schematic it says that I use a TO220 regulator, that isn’t needed as the microcontroller, display and real time clock use just a few milliamps. My clock uses a smaller TO92 version of the 7805 capable of supplying 150mA.

The switching of the led-strings is done with N-channel MOSFETs. Again, in the schematic it shows other devices than I used. I happened to have exactly three very old BUZ11 MOSFETs instead of the newer IRLZ34N MOSFETs. They work fine

.

Of course you can put in as many leds as you like, as long as the MOSFETs and the powersupply can handle the current. In the schematic I have drawn just one string of any colour, in reality there are several each colour parallel to the other strings of that colour.

Step 5: Resistors (for the Leds)

About the resistors in the led strings.
White and blue leds usually have a voltage of 2.8V over them when they are at full brightness.

Red leds have just 1.8V, my green leds have 2V over them at full brightness.

Another thing is that their full brightness isn’t the same. So it took some experimenting to make them equally bright (to my eyes). By making the leds equally bright at full brightness, they will also look equally bright at lower levels, the pulse width signal always switches them on at full brighness but during longer and shorter times, your eyes take care of the averaging.

Begin with a calculation like this. The power supply delivers (in my case) 12V.

Four white leds in series need 4 x 2.8V = 11.2V, this leaves 0.8V for the resistor.

I had found that they were bright enough at 30mA so the resistor needs to be:

0.8 / 0.03 = 26.6 ohm. In the schematic you see that I put in a 22 ohm resistor, making the leds just a little bit brighter.

The blue leds were too bright at 30mA, but compared nice to the white leds at 15 mA, they also had about 2.8V over them at 15mA so the calculation was 4 x 2.8V = 11.2V again leaving 0.8V

0.8 / 0.015 = 53.3 ohm so I chose a 47 ohm resistor.

My red leds also need some 15 mA te be equally bright as the others, but they only have 1.8V over them at that current. So I could put more in series and still have some “room” for the resistor.

Six red leds gave me 6 x 1.8 = 10.8V, so over the resistor was 12 – 10.8 = 1.2V

1.2 / 0.015 = 80 ohm, I made it into 68 ohm. Just as the others, a tiny bit brighter.

The green leds I used are as bright as the others at about 20mA. I needed just a few (just as the blue ones) and I chose to put four in series. At 20mA they have 2,1V over them, giving 3 x 2.1 = 8.4V

12 – 8.4 = 3.6V for the resistor. And 3.6 / 0.02 = 180 ohm.

If you build this wakeup light it is unlikely that you have the same power supply, you will have to adjust the number of leds in series and the resistors needed.

A small example. Say you have a powersupply that gives 20V. I would chose to set 6 blue (and white) leds in series, 6 x 3V = 18V so 2V for the resistor. And lets say you like the brightness at 40mA. The resistor then needs to be 2V / 0.04 = 50 ohm, a 47 ohm resistor will be fine.

I advise not to go any higher than 50mA with ordinary (5mm) leds. Some can handle more, but I like to be on the safe side.

Step 6: Software

All the code can be downloaded from:

https://gitlab.com/WilkoL/wakeup_light_stm8s103

keep the source code open, next to the rest of this instructable if you want to follow the explanation.

Main.c

Main.c first sets up the clock, timers and other peripherals. Most of the “drivers” I wrote using the Standard Library from STMicroelectronics and if you have any questions about them, write it in a comment below the instructable.

Eeprom

I left the “text to display” code that I used to put texts in the eeprom of the STM8S103 as comments. I wasn’t sure that I had enough flash memory for all my code so I tried to put as much as possible in eeprom to have all flash for the program. In the end that proved not necessary and I moved the text to flash. But I left it as commented out text in the main.c file. It is nice to have it, when I need to do something similar later (in another project)

The eeprom is still used, but only for storing the wakeup-time.

Once a second

After setting up the peripherals the code checks if one second has passed (done with a timer).

Menu

If that is the case it checks if a button was pressed, if so it enters the menu where you can set the current time, the day of the week and the wakeup time. Remember that it takes about 5 minutes to go from off to full brightness, so set the wakeup time a bit earlier.

The wakeup time is stored in eeprom so that even after a power outage it will “know” when to wake you. The current time is stored in the real time clock of course.

Comparison current & wakeup time

When no button was pressed it checks the current time and compares it with the wakeup time and weekday. I don’t want it to wake me in the weekend 🙂

Most of the time nothing needs to be done so it sets the variable “leds” to OFF else to ON. This variable is checked together with the “change_intensity” signal, that is also coming from a timer and is active 244 times per second. So when the “leds” variable is ON the intensity is increased 244 times per second and when it is OFF is decreases 244 times per second. But the increase goes in single steps where the decrease is in steps of 16 meaning that when the wakeup light has hopefully done its job, it turns off 16 times faster but still smoothly.

Smoothness and OUT OF MEMORY

The smoothness comes from the Sigmoid curve calculation. The calculation is quite simple but it needs to be done in floating point variables (doubles) because of the exp() function, see the file sigmoid.c.

In the standard situation the Cosmic compiler / linker does not have support for floating point variables. Switching it on is easy (once you have found it) but is comes with an increase in code size. This increase was too much to make the code fit in flash memory when combined with the sprintf() function. And that function is needed for converting numbers into text for the display.

Itoa()

To remedy this problem I created the itoa() function. This is a Integer To Ascii function that is rather common, but not included with the STMicroelectronics standard library, nor with the Cosmic libraries.

Source: Wakeup Light

SIMPLE QUADCOPTER ( HUBSAN X4 )

$
0
0

In this Instructable I will let you know the basic building block of a Quadcopter and how to make it in a very simple way.Only thing you need is some skill on Soldering and few basic tools.I think it will give opportunity to the new hobbyists to sharpen their skills on this platform.

[ Play Video ]

To demonstrate the process I choose Hubsan X4 -H107.Because its parts are very cheap, easily available,huge community resources in the internet.For a beginner I think it is one of the best Quadcopter to get started.

Note : If you already have a HUBSAN X4 then this guide will be helpful to repair it after a fatal crush.Just follow the steps in the reverse order.

What is a Quadcopter :

A Quadcopter is a type of helicopter with four ( Quad ) rotors, so it is known as Quadrotor. Because of its unique design, it allows a more stable platform, making it ideal for surveillance and aerial photography. A normal helicopter has one big motor to provide all the lifting power but a Quadrotor has four motors all work together to produce upward thrust and each motor lifts only one fourth of the total weight. The Quadcopter’s movement is controlled by varying the relative speed of each motor.

How it is Work :

A Quadcopter depends on the flight controller and Electronics Speed Controller (ECS) to distribute the correct speed to each of the 4 motors depending on what we want it to do.I found a great article on basics of Quadcopter on Learn Robotix blog. You can go through it to get more clear ideas.I am attaching the links below

http://learnrobotix.com/uavs/quadcopter-basics/wha…

How Do Quadcopters and Multicopters Fly?

Step 1: Parts and Tools Required :

Parts Required :

1. Flight Controller Module Rx ( H107-A43 ) – Amazon

2. Body Shell (H107-A21) – Amazon

3.Motors (H107-A23) – Amazon

4.Propellers (H107-A02) – Amazon

5.Rubber Feet (H107-A29) – Amazon

6.Blue LEDs (H107-A32) – Amazon

7.Red LEDs ( H107C-A33) – Amazon

8.Screw Sets ( H107-A07) – Amazon

9. Protection Cover ( H107C-20 ) – Amazon

10. Battery ( H107-A24 ) – Amazon

11. Charger – Amazon

12. Transmitter ( H107-16 ) – Amazon

13. Wrench ( H107 A11 ) – Amazon

Tools Required:

1.Soldering Iron ( Amazon )

2.Wire Cutter ( Amazon )

3.Wire Stripper ( Amazon )

4.Screw Driver (Amazon )

Step 2: Installing the Flight Controller ( Rx )

To control the Quadcopter and make the entire structure stable in air,it needs an electronic system which is called Flight Controller.It is the brain of the Quadcopter and uses gyros to keep the aircraft stable.

The Hubsan X4 Receiver Module ( Flight Controller Board ) has gyroscope, accelerometer, and radio receiver all placed onto a single PCB board to minimize space requirements and complexity.Another good thing is that all the soldering pads on the board are named neatly. So you can solder the motors and LEDs very easily.

The main components on the board are:

1. Hubsan HBS002 Processor

2. Invensense ITG-3050 Integrated Triple-Axis Gyroscope

3. 16 MHz Quartz Crystal Oscillator

4. 3210AP 3-Axis Accelerometer

5. A7105 2.4GHz Wireless Module

Step 3: Mount the LEDs

LEDs are very helpful during the night flying.There are 6 LEDs on Hubsan-X4 ,two on board and remaining fours are to be installed in each arm (near the motors). There are two pairs of LEDs i.e RED and BLUE.We have to installed the Blue pairs on the front and Red pair on the back side of the Quadcopter.

The LEDs have a red positive leads and a yellow/bronze negative lead.You can identify the colour by closer inspection, it looks like the heat shrink on the positive lead matches the LED colour.

Insert the wires of the LEDs in to the slots given in the each arm end.

Use a tweezers to thread the LED wires in to the leg slots.

Before going to solder,check it by using a coin cell.You may do this earlier also.I have found one of my red LED was damaged during shipping.

Then Solder the LEDs to the Flight controller.You can see soldering pads on the board are named neatly ( LED3, LED4 , LED5 and LED6 )

Step 4: Mount the Motors

The motors with the help of propellers provide lift and direction to the Quadcopter. They are controlled by Electronics Speed Controller.The Hubsan X4 Controller circuit board has a neat design where it´s almost impossible to connect wrong motor to wrong connections.There are two different type of motors clockwise (CW) and counter clockwise (CCW).The motors come with different coloured wire to identify it easily.

Clockwise — Black and White Wire

Counter Clock Wise — Red and Blue

Insert the wire and press the motor from top side to fix it.

Use a tweezers to thread the motors wires in to the arms.Put it just above the LEDs wires.

Then trim the extra wires by the wire cutter.

Solder the wires to the corresponding solder pads ( M1,M2,M3 and M4 )

Note : 1. The diagonal motors are of same type. 2. Black and Blue wires are negative.

Step 5: Install the Propellers

The propellers are mounted on each of the motors to provide the required thrust.

The 4 propellers are actually not identical. On closer look you can see that the propellers are tilted in different direction.By making the propeller pairs spin in each direction, but also having opposite tilting, all of them will provide lifting thrust without spinning in the same direction. This makes it possible for the Quadcopter to stabilize the yaw rotation, which is the rotation around itself.

There are two pairs of propeller.They comes with variety of colours. I ordered the black and green pairs.

On closer look you can see they are named like ” A” and ” B”.

Insert the black pairs in to the front side motors shaft.

Then insert the green pairs in to the back side motors shaft.Remember the diagonal blades are of same name.

i.e On a particular diagonal one Green A blade and another black A blade.

Step 6: Fix the Rubber Feet

Rubber feet are used to absorb the shocks from the 4 landing gears during the landing.It prevents the motors and the Quadcopter from severe shocks during crushing or falling from a height.

Slightly open the rubber slots and fix it to the each landing gear bottom projection.

Step 7: Close the Lower Shell

The lower shell have two parts the shell itself and the battery compartment.

First put the battery compartment in to the lower shell.

Fix it to the upper shell.The screw holes should be aligned.

Tighten the 2 screws on each side.

Finally apply pressure downwards on each arm to snap the lower body.

Step 8: Insert the Battery

LiPo batteries are used to provide power to the Quadcopter.

You can never have enough batteries when it comes to flying your Hubsan X4! With a flight time of just 5 to 8 minutes on a full charge, it is imperative that you own at least a couple of spare batteries to be able to continue flying your drone without any stopping. And if you are close to a charging source, then you can have you non-stop playtime!

Insert the battery in to the bottom battery compartment .

Twist the wires and squeeze them in to the notched holder as shown in above pics.

Make sure the battery and wires are pushed in to the end of battery compartment, so they will not negatively affect the centre of gravity and cause unstable flight.

Step 9: Protection Cover Blades Guard

If you are a beginner at flying a Quadcopter then you must ensure that you protect the blades of your Quad as much as possible by attaching a protection cover. Due to crashing or a shaky landing the blade can easily break or get damaged, ruining your flying experience.

Remove the propellers by the wrench. Position the cover four holes with the motor.

Press each of them on to the motors

Then re-install the propellers in their correct positions.

Step 10: Transmitter ( Tx )

The transmitter ( Radio Controller ) is a control unit for ground pilot to control the Quadcopter in the air.The transmitter uses Radio Waves ( 2.4 GHz) to communicate with the Quadcopter’s receiver unit.The most common features of of the Transmitters are

1. Channels : Each channel allows one individual thing on the Quadcopter to be controlled. For example in a 4 channel Transmitter, one channel for throttle, one channel for turning right and left, one channel for pitching forward and backward, one for rolling left and right.

2. Modes : There are 2 different Modes – mode one and mode two. It’s basically different control configuration.

The mode one configuration has the elevator control on the left joystick and the throttle on the right one. The mode two has the elevator control on the right joystick and the motor throttle on the left one

You can also use your smartphone as a Transmitter.If you are interested have a look the following Instructable by vshymanskyy.

https://www.instructables.com/id/Control-quadcopter…

Step 11: Test Flying

Hey, finally you made the Quadcopter, now it is time to fly !!!

Connect the battery plug with correct polarity. Then all LEDS should be light up ( blinking )

Power up the Transmitter by sliding the switch in the upward direction.

After few seconds you will listen a beep sound and see the LED should glow constantly.It indicates that your Quadcopter is paired successfully.

Now slowly raise the throttle stick and enjoy the flight.

Source: SIMPLE QUADCOPTER ( HUBSAN X4 )

MIDI Handpan With 19 Tonefields on Upper and Down Side…

$
0
0

Introduction

This is a tutorial of my custom made MIDI handpan with 19 volume sensitive tonefields, Plug’n Play USB capability, and a lot of easy to use parameters for adjusting the pads for your individual needs. It’s not a design award winning model 😉 but it perfectly fits to my needs in practicing handpan playing at home.

The building process is easy, but it takes some time. (Due to Corona lock down I had enough time in the last months to make this device). If you wanna make your own model and you have fun in cutting, sawing, a little soldering, then probably this is a project for you.

You don’t need any Arduino programming knowledge, because I used a standard drum trigger interface, that I mounted inside the base. The total costs for the materials are about 150.- Euro.

The usage of such a standard Trigger module (in my case an Alesis Drum Trigger I/O that I got second hand for 90.- Euros) has some important advantages, that I will describe in step XXX in this tutorial.

To play this instrument you need a PC or Mac, a DAW or a VST Player for free and some headphones or Speakers.

A few words why I did this and how I started by making a prototype with only 8+1 tonefields

I am a handpan player and one day I dreamed to have a MIDI-device with several tonefields, on which I can play similar to the playing techniques on Steelpans.

My intention was:

+ To have a practicing pad

+ To check out different scales before buying a real steelpan

+ The possibility to play calm via headphones

+ Using different soundfiles like Piano-Samples, Drumkits, Synths and so on in my DAW

I searched the web and found a site of a guy from Chile, who made a very nice electronic MIDI Handpan out of a really beautiful wooden body. But because my skills in shaping wood are not so good and so are also my electronic and programming skills, I began to look for alternative materials and techniques.

Months later deep in the night on the way to my home I found the right material standing very lonely near the street….. it was an old foam mattrass in a area of trash!! Now the idea for that device was born 🙂

The foam has really good characteristics: it is easy to cut with a knife for putting it into the right shape, it is lightweight and the most important fact: the material muffles the mechanical trigger impulse from one pad to the other pads, so a finger hit on one trigger will only trigger this pad and not the others.

For the drum pads I decided to use 4 mm Plywood after several experiments with different materials.

My first idea was the traditional layout with 8 Tonefields in the circle and one in the middle called “Ding”. In this version the drum trigger interface was outside the whole thing, standing beside on a table connected via a 15-pin cable.

In the middle of the building process I got the idea, why not putting the interface inside the instrument and why not use all 19 available inputs? Yeah! So the instrument grew….

In this instructable I will present you both versions

Go through every step until you reach step “If you want the faster solution”. This step will bring you to the version with tonefields only on the upper side. The steps after that show, how to build the version with bottom notes and inside trigger device.

So now it’s time to start! 🙂

Feel free to ask me, it can take some days till I will answer, but I am really interested in what other ideas you will have…

Step 1: What You Will Need

List of materials:

  • A drum trigger (I used the Alesis drum Trigger I/O)
  • Two pieces of 10 cm foam (I used an old mattrass) with diameter about 51 cm
  • Plywood 4 mm for 9 or 19 pads of 10,5 cm diameter. Important note: Check out the quality before buying. I saw some pieces and found some big holes inside. Or I had some pieces of wood that were not flat enough or a kind of wood that was too soft. The harder the wood, the better it will transmit the knocking impulse to the piezo while playing, especially when you hit the edge areasof the tone field
  • Plywood 8 mm for the plate in the middle with diameter a little bigger than your foam (about 53 cm)
  • Some meters of thin isolated flexible cable, I took blue for “ground” and orange for “hot”
  • 2 small standard stripboards
  • 10 Stereo headphone jacks (0,99 Euro)
  • Duck tape

You will need these extra materials for the smaller version and EXTERNAL drum trigger:

  • The number of piezos that you wanna have in the end plus some more (Important information about these Piezos and why you should have some more, go to step “Mounting the piezos”)
  • 15 pin Sub-D cable, 3 meters with one male and one female end

You will need these extra materials for the version WITH bottom notes and drum trigger INSIDE:

  • 4 pieces of 20 mm wooden log, about 6 cm long
  • The number of piezos that you wanna have in the end plus some more (Important information about these Piezos and why you should have some more go to step “Mounting the piezos”)
  • 2 pieces of 16-pin flat cable, about 30 cm each
  • 2 male 16 pin print connectors (Try to figure out the photo, what I mean, in german it’s called “Pfostenstecker”)
  • 4 female 16 pin print connectors (Pfostenbuchse)
  • 2 metal pieces + 4 screws + 2 female screws to mount the drum module
  • 2 angled metal pieces + 2 screws + 2 female screws for to mount the display
  • 3 meter USB-cable with A and B connector end

Tools:

  • A non permanent pen
  • Ruler, yardstick
  • Jigsaw and when you have: a table for sawing circles
  • Cyanoacrylate adhesive(Sekundenkleber)
  • Universal glue
  • Soldering bolt and tin solder
  • Electric drill
  • Sandpaper
  • Boxcutter
  • Big bread knife with serrated blade
  • Big scissors (those big ones for cutting paper are good), it should fit well in your hands because you will use this for some hours…
  • 20 mm metal tube to build a circular blade for cutting out holes in the foam
  • Plier
  • A small bench wise

Step 2: Cutting the Foam Base

  1. Draw a circle on the mattress by using a non-permanent pencil . I used a diameter about 51 cm
  2. Take a big knife with a serrated blade (e.g. a bread knife)
  3. Begin to cut the circle (take care of your fingers!) Try to give only a minimum pressure to the knife
  4. The result should look like a big cheese wheel
  5. Now you have to decide if you wanna have 8 or 9 tonefields in the ring area
  6. Because I decided to get 8 fields I made 3 even lines on the upper side (see photo). So I got 8 markers for the next steps
  7. Now start with one of the 8 or 9 fields. Take the scissors and cut off all material in that way, that you will get 8 or 9 similar flat areas. That job takes a little time
  8. Let a 2 cm rim at the bottom side

Step 3: Sawing the Tone Fields

Some words to the position of the tonefields:

Although the muffling characteristic of the foam prevents knocking impulse that you give on one tonefield from triggering a neighbouring tonefield, you should have a minimum space between the tonefileds. I checked out that 4 – 5 cm space is enough. In the upper area some of them have only 2 cm space and therefore I have some triggering of a neighbouring field in some playing situations.

BUT: When you are playing real steelpans you will recognize, that playing on one tonefield is always triggering other tonefields. That’s a natural characteristic of steelpans. The most scales of steelpans are designed in a way, that the sound of neighbouring tonefields doesn’t cause in inharmonic sound. So I think the mechanical insulation of the tonefields need not to be 100% perfect.

Now let’s start sawing:

  1. I used a special stand for my jigsaw in that way that the saw is fixed upside down inside a plastic ground, so you can use it like a band-saw. If you have no special stand for your jigsaw you can use it also in the common way by hand. Be careful in this process!
  2. The blade should be a special one for sawing narrow curves, those let you saw really good circles.
  3. At this time you should make a decision of the numbers of tonfields you wanna have on your instrument.
  4. The diameter I decided was 10,5 cm for the normal sized tone fields and 7 cm for the smaller ones. For the “smiley mouth”, i used 2 quarters of a circle, they are about 3,2 cm wide.
  5. Draw your circles on the wood and begin sawing.
  6. Important note: The saw will produce some splinters on one side of the wood, that’s normal. On the other side you should get an exact edge
  7. After the sawing process begin to polish the edge of the upper side of the pads, so that they get a little bit rounded. When you later play on the instrument, the fingers will knock sometimes on this edge. Rounded edges will give you more playing comfort.
  8. Now you could paint the pads with colours or wax the surface.

Step 4: Mounting the Piezos

Important Information about the piezos:
In my area (Germany) the exact type I used is EPZ-27MS44W (27 mm diameter, 4400 Hz, 200 Ohm, 21.000 pF). I am shure other models will also work properly. I took these because they are very cheap, only 0,39 Euro and they have some cables already mounted and the diameter is really big enough.

Before you buy them, I really recommend to have some more of them, the reason is:

Electrical output differs from one to another piece. Some of them produce more voltage than others. This is normal within a range of tolerance for this product. When I tried different pieces in my DAW, I noticed this difference very well. The result was a higher or a lower MIDI volume and this was really remarkable.

The solution was a simple selfmade test station!

Unfortunately I forgot to make any photos, so I try to put it into words here…

The Piezo test station:

I took a base out of 30 cm x 10 cm wood, where I mounted a kind of a „sliding board“ formed of paper which ends about 5 cm above the base. At this endpoint on the base I draw a circle of 30 mm diameter. Now I cabled one input of my drum trigger interface into two cables beside the test station. I started my DAW and zoomed very deep in track view. By pressing record I could see the volume amount of the incoming Volume data.

Now I began to test every piezo. Just by laying a piezo on the circle, clambing the two cables to the piezo and let roll a small plastic marble on the sliding board. You should always use the same level when starting the marble. Make about 5 to 10 trials per piezo to get a useful average of the volume signal. When I evaluated a aproximate average of the volume data, I devided all tested piezos into 3 groups: low, middle and high. For my project I now used the piezos of only one of these 3 groups. The exact amount of output voltage is not important, but the difference between the different piezos.

Although the Midi drum trigger interface gives the opportunity to adjust the relation between incoming voltage and MIDI volume output signal, it is important to seperate out those piezos that give a very low or a very high voltage.

Because the piezos are really cheap I buyed about 40 pieces. I am shure I will make other MIDI devices one day…

So now we gonna glue the piezos onto the pads:

  1. Use a very fine piece of sandpaper and make the surface of the piezo a little bit rough. Be sure to use the right side where no cables are mounted!
  2. And do the same in the middle of the wooden pads.
  3. Now use some drops of cyanacrylate adhesive and glue the piezos on the surface.
  4. Press with your fingers for 30 seconds (be careful to get no glue onto your skin).
  5. Don’t use a bench wise (Schraubstock), it could damage the piezo!
  6. Now take 2 pieces of thin cable about 25 – 30 cm long and solder them.
  7. After that fix the cables with tape.
  8. Do that with everysingle tone field

Source: MIDI Handpan With 19 Tonefields on Upper and Down Side…

Hands-Free Cardboard Gumball Machine

$
0
0

We made a Touch-Free Gumball Machine Using a micro:bit, a Crazy Circuits Bit Board, a distance sensor, a servo, and cardboard. Making it and using it was a “BLAST”! 😂 🚀

When you place your hand in the base of the rocket, a distance sensor hidden inside detects your hand and the machine administers a gumball, without touching a thing!

If you like our projects and want to see more of what we get up to each week please follow us on InstagramTwitterFacebook, and YouTube.

Supplies:

Brown Dog Gadgets does in fact sell kits and supplies, but you don’t need to buy anything from us to make this project. Though if you do it does help support us in creating new projects and teacher resources.

Electronics:

Other Supplies:

Step 1: Make the Center Tube

  • We made the center tube by peeling the paper off of one side of the corrugated cardboard and rolling it inside the core of a roll of tape. This gave us a 3-inch outer diameter tube.
  • We cut a small rectangular hole in the tube a few inches from one side and glued the servo in place.
  • We used duct tape on the inside of the tube to secure it.

Step 2: Add the LEGO Beam

  • We attached a LEGO Beam to the servo and tested the placement of the gumball.
  • Here’s how it will work: the gumball will fall down into the bottom of the beam’s “V” and get stuck. When the servo turns, it will move the gumball to the left and at the same time prevent the next gumball from falling until it returns to its original position.

Step 3: Make the Gumball Track

  • We measured the gumballs (ours were about an inch) and added 1/8th of an inch for some wiggle room.
  • We multiplied that measurement by 2 and added the diameter of the center core (which was 3 inches).
  • We cut cardboard disks with that diameter.
  • We cut 3-inch circles from the center of each disk to accommodate the center tube.
  • We cut slits into the circles to separate them and create the corkscrew. We used super glue to keep the corkscrew pieces in place – making sure that they were placed at the correct angle to allow the gumball to fall downwards.
  • At the beginning of the track, we added a piece to stop the gumball from falling to the next level.
  • In the middle, we made the track stop at the LEGO beam and start again just after.
  • At the end, we cut a hole for the gumball to escape, and added a piece to block the end of the track.

Step 4: Direct the Gumball Through the Hole

We created an extra piece that directs the gumball through the hole. We added the front triangle to this piece for decoration.

Step 5: Make the Base

Here’s how we created the template for the base:

  • Our goal was to create a cylinder-like shape with many flat sides that was slightly larger at the bottom than the top.
  • To figure out the correct measurements, we cut one circle from paper that was a bit larger than the base of the gumball track, and another circle that was a little bit bigger than that.
  • To figured out what the measurement of the top and bottom of our trapezoid template would be, we folded the paper into 16 pieces like a pizza and measured the straight length between the ends of the folds on both pieces. (You can see the notches in the first picture.)
  • We then created a template using these measurements and the height that we wanted the base to be. (2nd photo.)

Step 6: Cut Pieces & Build the Base

  • We cut out 16 of these shapes with a 1/4 inch extra on the edges to glue them together and create the vertical lines.
  • We glued them all together with superglue.

Source: Hands-Free Cardboard Gumball Machine

A Bluetooth ESP32 TFT + Touch Macro Keypad)

$
0
0

Controlling your computer by using hotkeys and macros is a great way of speeding up your workflow. Unfortunately a device dedicated to doing that (for example Elgato’s Stream Deck) will cost you about $120.

That is why I designed FreeTouchDeck. FreeTouchDeck will cost you about $20 (including shipping!) to make. It uses an ESP32 and a 3.5″ touch screen. Keystrokes and macros are send via Bluetooth to your Windows, MacOS, or Linux computer.

You can customize your FreeTouchDeck by using the configurator. The configurator is a webpage that is hosted on the ESP32 itself. You can customize menus, buttons, logos and colours. You can also create your own button logos and upload them.

This is a really simple build and will take up less then an hour of your time + a few cups of coffee. I designed it so it can be build using parts that can be easily found on AliExpress and Banggood but can also be found locally if you do not want to wait a while before the postman comes.

Supplies:

  • A 38-pin ESP32-WROOM-32 Development Board AliExpress
  • An ILI9488 TFT screen with XPT2046 touch controller AliExpress
  • An optional ESP32 + TFT Combiner PCB

Tools:

  • A soldering iron and solder.
  • Wire strippers (if you are not using the PCB).
  • Flush cutter.

Step 1: Learn More About FreeTouchDeck

Before you start this project it might be a good idea to watch the video I made. The video in itself isn’t a how-to, but more of an introduction to what FreeTouchDeck is and what it can do for you!

Watched the video? Let’s get the parts you’ll need!

Step 2: Get the Parts You’ll Need

If you do not already have an ESP32 and an ILI9488 TFT + Touchscreen lying around. You can find them pretty cheap on AliExpress. I used these parts:

– A 38-pin ESP32-WROOM-32D Development Board from AliExpress*

– An ILI9488 TFT screen with XPT2046 touch controller from AliExpress*

– An optional ESP32 + TFT Combiner PCB (Gerber file)

Not all ILI9488 TFT screens are created equally. It is important to make sure you have selected a screen with touch!

*Full disclosure: these are affiliate links

Step 3: Hardware: Connect the TFT Screen to the ESP32

The wiring may seem a bit daunting at first. But don’t let all the wires scare you. It is pretty straight forward. The images above will help you when you wire your TFT + Touchscreen to your ESP32. This is also decision making time. There are few options when it comes to connecting the two together. You can use a breadboard, you can use prototyping board or you can order a PCB specifically to connect the ILI9488 + touch to the 38-pin ESP32 DevKitC. I’d like to point out that the breadboard option is only an option for testing your connections and screen. It is not very practical to have on your desk and loose connections can cause problems.

It is important to know that these screens run at 3.3V. Connecting them to 5V can cause damage!

These are the connections you need to make from the ESP32 -> ILI9488:

3.3V -> VCC

GND -> GND

GPIO15 -> CS

GPIO4 -> RESET

GPIO2 – > DC/RS

GPIO23 -> SDI(MOSI) and T_DIN

GPIO18 -> SCK and T_CLK

GPIO32 -> LED

GPIO21 -> T_CS

GPIO19 -> T_DO

GPIO27 -> T_IRQ

SDO(MOSI) is not used for the TFT screen, so you are left with one unconnected pin on the TFT module. That’s ok!

If you like to order a PCB designed to make it easy to connect the ESP32 to the TFT screen, you can download the gerber files here: https://github.com/DustinWatts/ESP32_TFT_Combiner

You can also order them directly from PCBWay where I had mine made:

https://www.pcbway.com/project/shareproject/ESP32_TFT_Combiner_V1.html

Step 4: Software: Installing Arduino IDE Libraries

Installing the Arduino IDE ESP32 core.

Go to Arduino -> Preferences and click on the icon behind the input field for Additional Board Managers URLs.

Next, copy and paste the following link (without quotes) in the popup box:

“https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json”

Click OK and OK.

Next, go to Tools -> Board: -> Board Manager and search for “ESP32”. Install the latest version and click “Close”.

Installing the necessary libraries.

FreeTouchDeckuses a few (some might call 6 more than a few) libraries. Three of these libraries can be installed though the the Library Manager. Go to Sketch -> Include Library -> Manage Libraries and search for, and install the following libraries:

  • Adafruit-GFX-Library
  • TFT_eSPI
  • ArduinoJson

The other three libraries need to be downloaded manually. For each of them the process is the same so I’ll describe just one of them.

Go to “https://github.com/DustinWatts/ESP32-BLE-Keyboard”, click on “Code” and “Download .ZIPIn the Arduino IDE, go to Sketch -> Include Library -> Add .ZIP library

Repeat for the following libraries:

  • “https://github.com/me-no-dev/ESPAsyncWebServer”
  • “https://github.com/me-no-dev/AsyncTCP”

Step 5: TFT Screen Configuration

Before compiling and uploading the FreeTouchDeck.ino sketch, you will have to edit the user_setup.h file included with the TFT_eSPI library. This can be found in your Arduino sketchbook folder under “libraries“. If you have not renamed the TFT_eSPI library folder, the file user_setup.h can be found in TFT_eSPI-master. Here you will have to uncomment the lines that apply to your hardware configuration.

To make things easier, you can find the user_setup.h file you will need for this project in the downloaded repository in the “user_setup.h Examples” folder. Copy the file “ESP32_Dev_Kit_V1_ILI9488_Resistive.h” to “/TFT_eSPI-master/“. Rename the “User_Setup.h” that is already there to “User_Setup.old” (this way you keep the original in case something goes wrong). Now rename “ESP32_Dev_Kit_V1_ILI9488_Resistive.h” to “User_Setup.h“. (<- CASE sensitive!) Save and close the file.

Step 6: Download FreeTouchDeck.ino and Upload to the ESP32

ESP Sketch Data Upload Tool

FreeTouchDeck uses the SPIFFS (ESP32 flash memory) to store configuration and images that are used. You’ll need to upload these to the ESP32 before you upload the sketch to the ESP32. For this you’ll need the ESP32 Sketch Data Upload tool. You can download this from Github: “https://github.com/me-no-dev/arduino-esp32fs-plugin”. Follow the instructions on the Github to install the tool:

  • Download the tool archive from releases page.
  • In your Arduino sketchbook directory, create tools directory if it doesn’t exist yet.
  • Unpack the tool into tools directory (the path will look like /Arduino/tools/ESP32FS/tool/esp32fs.jar).
  • Restart Arduino IDE.

(On MacOS create the tools directory in ~/Documents/Arduino/ and unpack the files there).

FreeTouchDeck.ino

On Github you can find the full source code for FreeTouchDeck. Go to the FreeTouchDeck Github repository and click “Code” and “Download .ZIP”: https://github.com/DustinWatts/FreeTouchDeck

Extract and rename the extracted folder to “FreeTouchDeck”. Open the FreeTouchDeck.ino sketch in the Arduino IDE. This will also open a few other header (.h) files. You do not need to touch (pun intended) these.

Set your WiFi Settings

Once you have the FreeTouchDeck.ino sketch open go to the folder you have the FreeTouchDeck.ino sketch in, open “/data/config/wificonfig.json”. This is where you can enter you’re WiFi SSID and Password so you can connect to your FreeTouchDeck to configure it

  • change “YOUR_WIFI_SSID” to the WiFi SSID you want FreeTouchDeck to connect to.
  • change “YOUR_WIFI_PASSWORD” to the Password that WiFi network uses.

Upload the data folder

Before you upload the data folder to the ESP32, you’ll first have to select the right partitioning scheme.

  • Go to Tools -> Board and select ESP32 Dev Module.
  • Still under Tools, select Partition Scheme. -> “No OTA (2MB APP/ 2MB SPIFFS)”.
  • Plug in the ESP32.
  • Click on Tools and select “ESP Sketch Data Upload”.

Tip!: If the data upload fails, chances are you have the serial monitor open. If this happens, close the serial monitor and try again.

Upload the sketch to the ESP32

After the data folder is successfully uploaded, you can go ahead and upload the FreeTouchDeck.ino sketch to the ESP32. The settings under tools besides the Partition Scheme can be left to the default.

Go to “Sketch” and select “Upload“. This may take a while because it is a large sketch.

Step 7: Printing a Case (optional)

Off course not necessary, but when you have built your FreeTouchDeck you can print a case for your FreeTouchDeck. This design will fit the screen and ESP32 with or without the combiner PCB.

The case is designed to be a press-fit. You could however add a touch of CA glue (crazy glue) to keep the top firmly attached to the bottom.

You can find the case on Thingiverse: https://www.thingiverse.com/thing:4661069

I printed it in PLA with a 0.2 mm layer height. The top doesn’t need support if you print it face down. The bottom needs some minimal support if you print it with the opening down.

If you like to modify the case to your liking, you can find the Fusion 360 files on Github: https://github.com/DustinWatts/FreeTouchDeck/tree/master/case/ESP32_TFT_Combiner_Case

I’ve included some images of my slicer.

Source: A Bluetooth ESP32 TFT + Touch Macro Keypad)

Binary DVM

$
0
0

Binary displays are very popular for clocks so it looked like there a gap waiting to be filled in the measurement area with an instrument that displayed its results in a Binary format. As result I decided that a DVM would be a suitable project to be given a Binary makeover.

The Microbit has the means via an ADC (Analogue to Digital Converter), to convert analogue inputs into digital values. These digital values can then be used to create a myriad of applications.

In this case I will describing how to make a Battery powered Digital Volt Meter (DVM), but in addition to this I will have the ability to display the voltage in Binary as well as the usual Decimal values.

** NOTE ** ENSURE THAT ANY VOLTAGE DIRECTLY APPLIED TO THE MICROBIT DOES NOT EXCEED THE SUPPLY RAIL (~3V), AS YOU WILL DAMAGE THE MICROBIT

If you were to apply a DC input to the ADC this being limited by the supply would mean that ~3V would be the maximum.

However, there is a way to overcome this limitation with a few additional components to measure voltages greater than the supply without causing damage to the MicroBit.

It must be noted that there is a limitation to what this simple DVM will measure and its only intended for low voltage positive DC applications in this case 0 to 20V.

Supplies:

MicroBit – Qty 1

Battery Pack – Qty 1

9k resistor* – Qty 1

953R resistor* – Qty 1

200R multi turn potentiometer* – Qty 1

1K resistor* – Qty 4

*All resistors 0.1W or greater.

Veroboard – Qty 1

Veropins – Qty 3

Bread:bit Edge Connector Breakout Board – Qty 1 or similar to allow the Microbit to be connected to the potential divider.

LED red low current – Qty 2

16 pin DIL socket or SIL socket strip – Qty 1

DMM

PSU, fixed or variable voltage.

PP3, 9V non rechargeable battery.

In the absence of a PSU a battery as indicated may be substituted.

4 pin single in line (SIP), pin header – Qty 2

Step 1: Potential Divider

In order to enable a voltage greater than the supply to be applied to the ADC input we will be using a potential divider network.

This network will enable the application of a scaled voltage at the ADC input, this scaling will be accomplished using resistors.

The basic network is made up of two resistors which divides the applied voltage across each resistor.

If we adopt a scaling factor of 1/10th the input, at the ADC then for an applied voltage of 20V; the maximum voltage at the ADC input would be 2V which is well within the capability of the ADC with a safety margin of 1V.

If we create a resistor potential divider using 9K & 1K with 20V across the network the voltage across the 1K resistor will be 20 * (1k/10k) = 2V.

However, components have tolerance and even with 1% resistors the voltage could be between 1.96V and 2.04V

Therefore, in order to compensate for the +/-40 mV variance we can add some variable resistance into the network to adjust for component, voltage & temperature variation.

Using a 1% 9k resistor and a 1k trimming resistor best case typical of 10% [0k9 to 1k1], its resistance would be between 0R (0V) and 1k1 max (2.198V [8K91] or 2.159V [9K09]).

Values significantly less then the value to be compensated for in this case 2V are undesirable.

Therefore, if the 1k potentiometer is replaced with a 1% 931R (0k922 to 0k94), fixed resistor in series with a 10% 200R (180R to 220R) potentiometer. This gives a compensation range of 1.84V to 2.3V (-160mV to +300mV).

Therefore, to set an accurate maximum input at the ADC we set the maximum input to be measured and adjust the potentiometer to get an accurate output. Using a DMM in both cases to set the voltages.

In the absence of a DMM to measure the input voltage use a 9V primary non-rechargeable battery as the input to the potential divider and adjust the potentiometer for 1/10th the input voltage (900mV), once the assembly is complete.

Step 2: ADC (Analog to Digital Conversion)

In order to convert the digital value that represents the input voltage into a value that can be displayed on the Microbit the following calculation is applied.

ADC 10 bit resolution = 0 to 1023 bits.

1 bit resolution = Vs/1023 = 3.226 mV, where Vs = 3.3V if powered by USB

If using a battery the voltage (Vs), will vary based on the type of battery and its state of health.

Therefore.

Volts = ADC value/1 bit resolution

100.006 mV= 31/3.3e-3

As the input has a 10:1 divider in the form of the resistor potential divider the resulting value is multiplied by 10.

100.006mV*10 = 1000.06mV (1.00006V) at the input of the potential divider.

This is coded in the Microbit within function Vconvert.

The ADC value is read into variable VIN.

Values >=0 are converted in to the equivalent voltage, VOUT

Vout = Vin * Vpbit * 10

But with zero volts at the input an offset error will exist which needs to be taken into account and included in the calculation.

The offset (Voff), can be found by connecting the ADC input to 0V

This value is then set to be stored in Voff.

The calculation then becomes:

Vout = Vin * Vpbit * 10 – Voff

Step 3: The Code

The Blocks code for the Binary/Decimal DVM

Step 4: Decimal Display

Having converted the digital value into a voltage, we now want to display this on the Microbit.

This is initiated by the On Button A pressed.

Vout is first converted to text.

A substring of the text containing 7 characters is created.

To this text is concatenated the letter ‘V’ for volts.

Show string is used to display the result.

This will scroll the result across the screen until all the has been displayed leaving a blank screen.

An example file is included with the same measurement displayed in both Decimal and Binary format.

The decimal value is 10.150V

Step 5: Binary Display

This is the part of the code that converts the Decimal value into its Binary equivalent.

An explanation into the layout of the display will clarify how the data is arranged.
4 rows x 5 columns are used to display the numeric data with one column per decimal value. The column is arranged with the LSB on row 0 and the MSB on row 3 enabling a maximum Binary count of 15, but as this is representing a Decimal digit then the maximum value will be limited to 9. Row 4 the top row is assigned to symbols, these symbols being ‘-‘ (-ve) and ‘.’ (decimal point).

This process is initiated in the on button B pressed.

The result of Vconvert is converted to a text string of 5 characters and stored in STRVAL

A do while loop is executed for the character length of STRVAL

Each character is then split out in turn into STRMID

If STRMID is a number then this is converted into its Binary equivalent value, a non numeric value is given a default Decimal value of 16.

This process calls function DEC2BIN with two passing parameters, VALUE & INDEX3.

VALUE is the Decimal number to be converted and INDEX3 is the column number were the Binary value or Symbol will be placed.

An array LIST2 is defined with 5 elements, one element per column digit.

The process for converting the decimal value to its equivalent Binary value follows the form:

Take for example Decimal 6 to Binary.

6/2 = 3 r 0

3/2 = 1 r 1 = 011 (reverse) = 0110 (4 bits assigned per column)

The remainder from each division were the remaining integer is >1 is divided by 2 until no further integer division is possible. The remainder is stored in each element of LIST2 in the order calculated but this results in the MSB in element 0 and the LSB in element 3 which requires that the order in the values are reversed.

A do while loop is executed for the length of LIST2.

If the VALUE is >1 then it is divided by 2 and the remainder is stored in LIST2 at the index and VALUE becomes the integer, and the loop repeated else VALUE is stored in LIST2 at the index and the loop exited.

This process results in the Binary value being stored in LIST2 however, the elements are in reverse order and a Reverse LIST2 is executed to put each Binary bit in the correct order LSB at element 0.

Once the Binary value has been calculated it is displayed as a 4 bit word or nibble in the designated column. With one nibble per column up to a maximum of 5 columns. Symbols will be assigned to a 5th bit with all other bits=0 creating the following format 00001 or 00000. A one in the 5th bit indicating -ve or the decimal point and a zero indicating the absence of either of these symbols.

A designated column can only be assigned to a number or a symbol at any one time, numbers or symbols will not be mixed on the same column.

A do while loop is executed for the array length of LIST2

If the value in LIST2 at the element referenced by INDEX2 is one the LED in the reference column at the row referenced by INDEX2 is illuminated, if the value is zero the LED is un-plotted.

This will continue until each LED in the referenced column has been processed the result being either a number or a symbol.

The result will be retained on the screen between measurements.

Source: Binary DVM

Clock Generator With Si5351 and Blue Pill

$
0
0

Clock generator

I recently build a pulse generator and it does its job well. It produces pulses of variable length and at several frequencies. But the number of frequencies it can produce is limited and for many jobs the length of a pulse is less important than its frequency. E.g. when you are testing a clock you need a certain frequency, often 32768 Hz, but the pulsewidth (duty cycle) isn’t so important. To address this I made a clock generator, it produces squarewaves of (approx) 50% duty cycle for every frequency.

Library

The frequencies are generated with a Si5351 chip from Silicon Labs. This chip can produce frequencies from 4 kHz up to 200 MHz. Usually I read the documentation of a chip and produce the code to use it. But this chip is so complicated that I chose to use a library made by Jason Milldrum, Sebastian Hesselbarth and Rabeeh Khoury. They made an easy to use C-library with one limitation, the lowest frequency you can generate is 1 MHz. I know that there is an extended version of this library for Arduino that starts at 4 kHz, but I didn’t want to use an Arduino. And I’ll tell you why.

No Arduino but a Blue Pill

A few months ago I made a dual channel oscilloscope with a Blue Pill and it worked well. But I never used it as I have a Rigol and a Pico oscilloscope. So it just sat there, gathering dust. Therefore I decided to convert it to something else, and that something else is this project, a clock generator.

Supplies:

Hardware

Si5351 module

Blue Pill module

ST7735 TFT display

74HC00 (quad nand)

2 rotary encoders with switch

Project box

Lithium ion battery

Holtek 7333 (low dropout voltage regulator 3.3V)

Perf-board

Toggle switch

some capacitors and resistors

ST-Link module or Segger J-Link (to program the Blue Pill)

Software

STM32CubeIDE

Si5351 library (made by Jason Milldrum)

MS-Paint (yes really!)

Step 1: High or Low Frequencies

High frequencies aren’t very important for me, I rarely use higher than 8 MHz, low frequencies I do need though. Often lower than the minimum of 4 kHz that the Si5351 can produce by itself. But now I have this library that will make the Si5351 produce frequencies starting at 1 MHz, so they need to be divided. Which is what’s a STM32F103C8 (the microcontroller on a Blue Pill) can do very well with its timers


Two outputs, not three.

The Si5351 has three outputs, the STM32F103 has four TIMERs and with three of these TIMERs it is possible to feed them with external signals. So it is possible to make a generator that produces three independent clock signals. I chose to use just two because it is enough for me and because the dual channel scope I’m converting has two inputs, that I can now use as outputs.

Channels are different

I started off with the idea to have both channels produce a maximum frequency of 1 MHz. While building, that idea changed, now channel 1 goes up to 40 MHz which is probably more than I will ever need.

With hindsight, I should have done this for both channels, but I was afraid that I did’nt have enough room on the pcb (perfboard) for two selectors (74HC00). It would have made the software less messy.

Step 2: Block Diagram and Schematic

Frequency range

The Si5351 produces frequencies from 1 MHz to 40 MHz for channel 1 and 1 MHz to 10 MHz, for channel 2. That signal is fed to TIMER2 and TIMER3 of the microcontroller. Depending on the selected frequency range it divides this frequency with 10 up to 1,000,000,000 in steps with a factor 10.
So the lowest frequency it can make is with the Si5351 on 1 MHz, divided by 1,000,000,000 is 1 milli Hertz. (one cycle every 1000 seconds) The highest frequency coming from the TIMERs is made with the Si5351 on 10 MHz, divided by 10 is 1 MHz.

Channel 1

For channel 1 there is an extra selector that takes the output of the Si5351 directly, so it skips the microcontroller. This will go from 1 MHz up to 40 MHz. Higher than that doesn’t really work because it is around the maximum of the 74HC gates.

Resolution and precision

There are seven digits you can set, on the 1 MHz to 10 MHz range you can therefore set it to e.g. 1.234 567 MHz with a resolution of 1 Hz. And as this is simply divided to all lower ranges it is also possible to get 1.234 567 Hz with a resolution of 1 uHz (that’s micro Hertz).

(Or even 1.234 567 mHz with a resolution of 1 nHz, although what use such extremely low frequencies have, I don’t know, maybe if you are doing something in geology?)

Oh, do not confuse resolution with precision, the Si5351 uses a 25MHz crystal oscillator that isn’t temperature controlled or temperature compensated. It will change several Hz (parts per million) when the temperature of the crystal changes. As all signals depend on this 25 MHz, they will change with it. But for hobby use its precision is more than adequate. The Si5351 can be tuned to compensate errors, but it doesn’t compensate for temperature changes.

The picture shows 5 kHz measured with a counter locked to a GPS 1PPS signal, after the Si5351 was compensated at 25 degrees Celsius.

Step 3: Hardware

Building the hardware was easy as most of it was already done for the dual channel oscilloscope, the tft screen needed no changes, one rotary encoder was moved a few pins on the STM32F103 because the pins it was connected to are now used for a TIMER, power also remained the same lithium-ion battery and Holtek 7333 low dropout regulator. The Si5351 just needs 3.3v, two wires for I2C and two other wires for the two outputs, so that was easy too.
Most work was the removal of the analog amplifier of the oscilloscope. It needed to go to make place for the 74HC00. The project box needed no changes at all.

The picture shows part of the schematic in MS-Paint, with colors I paint over the lines with different colours to show with pin connects to which pin. After actually soldering the connections, I press CRTL_Z in MS-Paint to erase them. So MS-Paint DOES have its use after all! 🙂

Three gates of the 74HC00 are used to connect either the Si5351 directly or the TIMER output to the output port of channel 1. And the fourth gate is used as a buffer for the channel 2 port.

Step 4: Software Development and Testing

(It is handy to have the code open in another screen if you want to follow this, for some reason I’m not allowed to upload a zip file with all the code so I will add the most important files to the next step. If you want to get the entire folder I will upload it to google-drive and share it.)

(note to myself, I really should take a look at Github or similar sites)

(EDIT so I setup an account on GitLab and if I did it right you can find the entire project folder in this place)

https://gitlab.com/WilkoL/clock-generator


The code first of all takes care of initialising all peripherals in the STM32F103. GPIO, TIMERs, I2C and SPI, then it enables those peripherals and starts initialising the TFT-screen and Si5351. After that some info is shown on the screen (a small todo is to measure the battery voltage, I might add that later).

The default values are then set and send to the Si5351 and TIMERs of the microcontroller. Now it is ready to start working, which happens inside the never ending “while (1)” loop.

Input This loop checks if the rotary encoders were turned or pressed and if so starts the neccessary actions. The actual reading of the rotary encoders is done inside the interrupt routine of TIMER4. This interrupt is triggered 10000 times a second, it checks the GPIO that the rotary encoders are connected to and does the debouncing of those signals. The pins of the rotary encoders need to be active for 8 times that the interrupt runs (0.8 ms) before they are seen as active. The button needs to be active 16 times (1.6 ms) before it is considered pressed.

The interrupt routine signals the main function with a -1 of the encoder is turned counter clockwise and 1 when clockwise. The button on the encoder just sends a 1 when pressed.

A short explanation of how this works, consider this pseudo code, remember that the interrupt routine is called often, in this case 10,000 times per second.

pseudo code:

volatile uint8_t signal;                         //global variable<br>interrupt_routine()                              //this will be called very often
{
    static uint8_t button;                       //static variable
    button <<= 1;                                //shift one place to the left
    if (physical_button == pressed) button++;    //add a 1 to the left most bit
    if (button == 0xFF) signal = 1;              //when the physical button was pressed 
                                                 //at least 8 times in a row send signal
                                                 //to the main program
}

First of all a global variable is needed to be able to send a signal to the main program, the “volatile” keyword means that the program needs to read the content of the variable always, it could have changed at any time (as it does in interrupt routines)

Inside the interrupt routine the variables need to be static, meaning that they are not destroyed when the interrupt routine ends as would happen with normal variables.

The first thing to happen is a shift to the left, so all bits inside the variable move one place to the left making room for a 0 at the end.

Next a check is done to see if the physical button is pressed, if so a 1 is added, changing the 0 at the end into a 1.

If the physical button was not pressed nothing is done, so the 0 at the end stays 0.

The last line checks if all bits in the variable are 1, if so it sets signal to 1, indicating that the physical button indeed was pressed and bouncing was over.

You might notice that signal is never set to 0 in the interrupt routine. This is done by the mail program, after it has handled whatever it should do when the button was pressed.

Shown below are two pictures of actual button presses, as seen on an oscilloscope. You may think you pressed that knob just one, the microcontroller knows better. Take a look at the time-divisions, that second picture shows a bounce that isn’t over after 600 us and you also see that it takes almost 1 ms before it really starts to make contact.

Source: Clock Generator With Si5351 and Blue Pill


MQTT Swimming Pool Temperature Monitor

$
0
0

This project is a companion to my other Home Automation projects Smart Data- Logging Geyser Controller and Multi-purpose-Room-Lighting and Appliance Controller .

It is a pool side mounted monitor that measures the pool water temperature, ambient air temperature and barometric pressure. It then displays the pool water temperature on a local LED bargraph and transmits via WiFi/MQTT to a home system – in my case a software upgraded MQTT compatible version of the Lighting Controller. although it is easy to integrate it into any MQTT compatible Home system.

This Instructable focusses on the Pool Monitor design and construction, the upgrade of the Controller (new firmware and addition of an OLED display) will be included in the original controller shortly.

Key features include:

  • The absence of poolside mains electricity determines a 18650 battery power supply with an integrated 1W solar polar panel to maintain the battery charge, battery life is further optimised by the use of the ESP8266 “Deep Sleep” mode. In my system, the unit was able to run over our “active swimming pool season” (November through to April) without manual intervention of manual top up charge.
  • An optional local built in 8 LED bargraph displaying the pool temperature in 1 degree intervals.
  • MQTT data transmission via local WiFi connection to any compatible host system.
  • All programming is achieved over WiFi using the Monitor as an Access Point and internal Web Server configuration pages with all programmable parameters being stored in internal EEPROM.
    • Time intervals between wake up and transmissions. 1 to 60 minute intervals.
    • Configurable MQTT topic/message formats
      • Individual message topics (E.g PoolTemp, AirTemp, BaroPress)
      • Single compact topic (E.g. Pool Temp + Air Temp + Barometric pressure)
      • Compatible with OLED display mounted on Multi-purpose-Room-Lighting and Appliance Controller (see title figure for example)
    • WiFi network SSID and password
    • Access Point SSID and password
    • LED bargraph control
      • Programable minimum temperature range (15 to 25’C)
      • Programmable permanently ON, permanently OFF, Only on during daylight hours

Although I 3D printed my own enclosure / mounting arrangement and used a PCB board from a previous project, you can literally use what suits your personal preferences as nothing is critical or “cast in stone”. The last section of this Instructable contains Gerber and STL Files for the PCB boards and ABS housing that I designed specifically for this project

Step 1: Block Diagram and Discussion About the Choice of Components

The block diagram above highlights the main hardware modules of the Pool Monitor.

Processor

The ESP8266 used can be any of the ESP03/07/12 basic modules through to the more perfboard friendly NodeMCU and WEMOS modules.

I used the ESP-12, If your pool is some distance from your WiFi router you may prefer the ESP-07 with an external antenna. The NodeMCU/Wemos modules are very board friendly but will result in a slight increased power consumption due to their extra onboard voltage regulator and LEDS – this will affect the ability of the solar panel to daily keep the battery in charge and you may require a periodic manual charge using the USB port on the charger module.

Temperature sensors – Fig. 2

I have used the easily available and low cost metal tube + cable versions of the DS18B20 temperature sensors that come with around 1 metre of connecting cable as they are already robust and weatherproof. One using the full length of the cable for the pool water measurement and another with a shortened cable for the ambient air temperature.

Air ambient sensor

I have selected the excellent BME280 module to measure the ambient air humidity and barometric pressure. You may be wondering why I did not used the air temperature measurement function of this module.

The reason is simple – if, as I did in the original prototype use this function, you end up measuring the static air temperature INSIDE the housing which tends to read high due to internal self heating of the enclosure air space by the outside sun (it reads perfectly at night!). It was quickly realised that the air temperature sensor needed to be mounted outside of the enclosure but in the shade away from the direct sun light so I switched to a second DS18B20 and provided a small mounting point underneath the enclosure. The BME280 temp sensor although is still used as a diagnostic measurement for the in-enclosure temperature and can be monitored on the configuration server main page.

LED bargraph – Fig. 1

The eight local high intensity LED outputs are driven by a PCF8574 IO expander chip which in turns drives each LED by a PNP 2N3906 transistor. The PCF8574 will indicate just one LED at a time (to reduce the power consumption) depending on the measured pool water temperature and will stay active even when the ESP8266 is in its sleep mode. Thus, if enabled, the LED bargraph will be active all of the time.

  • If the measured temperature is less than the minimum temperature assigned to the bargraph, then BOTH LED 1 and 2 will illuminate.
  • If the measured temperature is greater than the minimum temperature assigned to the bargraph+8, then BOTH LED 7 and 8 will illuminate.
  • If the light level as measured from output of the solar panel is lower than the threshold programmed in the configuration set up, the LED outputs will be disabled to save battery power, alternatively the bargraph can be permanently disabled (threshold set to 0) or enabled (threshold set to 100).
  • If your build does not require the bargraph simply omit the PCF8574, LED’s, transistors and associated resistors

Solar panel, battery and battery charging board

The basic power supply is simply a 2000mAH (or greater) 18650 LIPO battery fed through an 1N4001 diode to reduce the battery voltage (max charged battery = 4.1V and max ESP8266 voltage = 3.6V).

Lower capacity batteries will work but I have no feeling if the daily charging by the solar panel will be adequate.

Beware the higher capacity labeled batteries (E.g. 6800 mAH) – many on the market are fakes. They will work but at what capacity and reliability is anyone’s guess.

The 1W 5V solar panel is connected to the inputs of a TP4056 LIPO charger board and the output of the latter to the battery thus the battery will be charged when the light level is high enough to produce a usable charging voltage and also the battery can be manually charged via the USB connector on the TP4056 board.

If you intend to use the 3D printed housing design then you must use the 110mm x 80mm sized solar panel. There are other sizes available so just take care when purchasing as this may be critical when selecting your type/size of housing.

Also a word of caution re temperatures. It can be difficult to establish the true max temperature limit of these cheap panels as it is often not stated – I found 65’C max specified on one device but nothing on the majority of onsite suppliers. Now consider that the panel by design is a) black and b) going to be out in the bright sunlight all day every day – you may find it better to allow a little shade over the panel if it gets too hot. My unit has not suffered any failure (installed early 2019) but its reliability will surely depend on your local climate and probably mounting place.

Push buttons – Fig. 3

You might think that a push button is well “just a push button” but when it is on an enclosure that is outside in the sun and rain 24/7 then you need to take care of its specification. Electrically it is a simple component but the sealing integrity of your housing hinges on their mechanical quality. I used what is very popular waterproof single pole 12mm push button available from many suppliers – this has proved itself to be a very robust switch..

  • Button 1 is used as the reset button – used to manually force the monitor to make a measurement and transmit the result
  • Button 2 when pressed immediately afterpressing and releasing button 1 will instruct the monitor to start up its Access Point (AP) using the SSID and password that you have previously programmed it with. If fitted, each alternative LED on the bargraph lights up briefly to indicate that the AP is starting up.
  • Both buttons are also used in the initial build procedure to upload the firmware to the processor flash memory.

Note.
The 3 D printed housing is designed for these 12mm switches as listed in the bill of materials and as such are mounted on the side of the housing. If you are using your own housing I would recommend you fit them under the housing to shield them from weather exposure.

Toggle Button – Fig. 2

This is used to completely turn the monitor off when it is not being used and in storage. Note that the battery and solar panel remain connected to each other (but not the electronics) and so the battery will still receive charge if the panel is exposed to external light.

Enclosure – Fig. 3

This remains the last but very important component as this is the main component that provides protection for all of the other parts. The solar panel, push buttons, toggle switch, LED’s and temperature sensors all require drilling or cutting holes in the housing so water proofing is severely jeopardised if the sealing after fitting the items is not taken care of. I glued the solar panel to the cover then sealed inside with silicone sealing. The LED board was potted inside to ensure that all of the LED points were sealed on the inside. You get the picture – prevent any potential ingress points. Since I used a 3D printed ABS model, I sprayed the inside of the housing including the main PCB with PCB sealing spray (you can also just used paint) just as a precaution! Figure 1 shows the enclosure mounted by the pool side. The included STL files also include a simple mounting assembly that allows the enclosure to be assembled to the weir top cover. It can be mounted anywhere that suits you subject to the length of the water temperature sensor cable, exposure to sunlight and the viewability of the LED bargraph if fitted.

Step 2: Bill of Materials

I have included a “potential” bill of materials based on my own choice of components As previously stated, you do actually have a lot of flexibility when it comes to almost all of the build items. I have cut and pasted some items off the Amazon online shopping site purely as an illustration – not as a recommendation of supply. The 18650 battery can have direct solderable tabs for the wires or you can buy a “standard” type and battery holder (as I did) for ease of assembly

You will also need glue (2 part epoxy recommended), 4 x M4 nuts and bolt.

Depending on your location, you will have potentially more convenient and/or cheaper suppliers. For a fact, if you are not in a rush for the components, AliExpress promises significant reductions on some if not all of the major items.

Step 3: Electronic Build & Firmware Upload

The schematic reveals a relatively simple “standard ESP8266” with no “surprises” comprising of just the microcontroller and a collection of input devices (2 x DS18B20 temperature sensor, 1 x BME280 environmental sensor, 1 x PCF8574 IO expander, 2 x push buttons and a battery/charge/solar panel combination.

ESP8266 Pin assignments

  • GPIO0 – Start AP Button
  • GPIO2 – Not used
  • GPIO4 – I2C – SCL
  • GPIO5 – I2C – SDA
  • GPIO12 – DS18B20 Data
  • GPIO13 – Test – Not used
  • GPIO14 – Not used
  • GPIO16 – Deep Sleep wakeup
  • ADC – Solar Panel voltage

PCF8574 pin assignments

  • P0 – LED bargraph 1 – Minimum Temperature
  • P1 – LED bargraph 2 – Minimum Temperature + 1’C
  • P2 – LED bargraph 3 – Minimum Temperature + 2’C
  • P3 – LED bargraph 4 – Minimum Temperature + 3’C
  • P4 – LED bargraph 5 – Minimum Temperature + 4’C
  • P5 – LED bargraph 6 – Minimum Temperature + 5’C
  • P6 – LED bargraph 7 – Minimum Temperature + 6’C
  • P7 – LED bargraph 8 – Minimum Temperature + 7’C

Uploading firmware

A copy of the firmware source code is included in the downloads section. The code has been written for the Arduino IDE version 1.8.13 with the following additions ….

  • ESP8266 Board Manager (version 2.4.2)
  • OneWire library
  • Dallas Temperature library
  • EEPROM library
  • Adafruit BMP085 library
  • PubSubClient library
  • Wire library

Ensure that you select the correct baud rate on the Serial monitor (115200), and the correct board dependent on what version of the ESP8266 chip you are using).

If you need further instructions how to set up the Arduino IDE then refer to my two previous instructables, both contain extensive set up instructions and also there is a multitude of online r sources available. If all else fails, post me a message.

I have included in the build a connector for the serial port lines (TxD, RxD & 0V) for connection to your computer using a standard FTDI USB to TTL convertor and the two push buttons provide you with the ability to power the ESP8266 in flash programming mode. (Apply power with BOTH the Reset and Start AP buttons pressed, release the Reset button whilst still holding the Start AP button, then release the Start AP button)

Additional Notes

  1. The push button connections, power supply, DS18B20 Temperature sensors can be brought out to standard 0.1″ header pins for easy IO connections
  2. The 100 uF electrolytic capacitor (C4) and 100 nF ceramic capacitor (C6) should be mounted as close as possible to the power supply pins of the ESP8266.
  3. The 100nF ceramic capacitor (C5) should be mounted as close as possible to the power pins of the PCF8574
  4. Figure 10 illustrates the total wiring schematic – You can build all of the components on one board or split them into 2 boards with the PCF8574, 8 x 2N3906 transistors (Q1 to Q8), 16 x resistors (R3 to 14, R19 to 22), C5 on one “LED bargraph board) and the remainder on the “Controller board” (This is what I did)

Step 4: Using the Provided 3D Printed Enclosure

The choice of housing is flexible depending on your preferences and installation requirements. I 3D printed an ABS housing to suit my own installation and include it to either reproduce or use as an “inspiration” for your own construction. The STL files from the Download section can be printed at 0.2 mm resolution. If you do not own a 3D printer nor have a friend with one, there are many commercial 3D printing companies out there now who should be able to provide an affordable service for you.

The individual printed items are:

  • A. Enclosure base
  • B. Enclosure cover
  • C. Knuckle joint
  • D. Enclosure knuckle mount adaptor
  • E. Air sensor mount
  • F. Enclose sensor cable guide
  • G. 2 x rod (short and extended length – allows length of overall mount assembly to be varied)
  • H. Weir cover top adaptor
  • J. Weir cover bottom adaptor

Also needed are 4 x M4 threaded bolts and nuts

Notes

  1. Where items are glued, I recommend a two part epoxy resin or any suitable weatherproof glue.
  2. Glue the solar panel to the lid B and use silicon sealant in the inside of the cover to prevent any water ingress at the joining faces.
  3. Part E is glued to the part E at any point for mounting the air sensor. ALL of the air sensor must be below the housing base out of any direct view of sunlight (Ref Fig.5A)
  4. Part F and D should also be glued to the Enclosure part E base.
  5. The mounting knuckle assembly (G,C & G) fit together as a push fit and when their through holes are aligned, can be secured using 2 x M4 threaded bolts and washers (do not tighten until complete assembly is mounted and required orientation identified – do not over tighten to prevent cracking the plastic fittings). Cut the bolts to a suitable length if required.
  6. Mount parts H & J on the modified weir plat cover at a point where there is no risk of physical interference or stress from any pool cover strap etc (ref Fig 5 C,E & F). If the weir plate cover has a curved surface, I suggest that you use silicon sealant or epoxy to further bond part J to the underside of the weir cover.
  7. Now the enclosure assembly can be mounted onto the weir cover plate using the knuckle assembly (2xG & C). This knuckle assembly is a tight PUSH fit into both the enclosure base and the weir plate cover thus allowing the unit to be easily removed for winter stowage and/or maintenance. Do NOT glue this in place. Ref Fig. 5D
  8. Figure 4 outlines each part and how they fit together. For the mounting installation, I drilled a hole in my weir top cover to provide a mounting point for the mounting knuckle (This provides a 3 dimensional adjustment possibility for the housing relative to the the mounting mount)

Source: MQTT Swimming Pool Temperature Monitor

BOXOI – an Open Source Miniature 3D Zoetrope DIY Kit

$
0
0

Project Background: In 2015, I started a kickstarter project of a miniature 3D zoetrope DIY kit. The next year, I started the version 2 of said project by further simplifying the kit and reducing its manufacturing cost. Sadly, both crowdfunding failed, but this is how the 3D zoetrope looks.

*Zoetrope: a 19th-century optical toy consisting of a cylinder with a series of pictures on the inner surface that, when viewed through slits with the cylinder rotating, give an impression of continuous motion. —Definitions from Oxford languages

The original idea was to make a low-cost 3D zoetrope for personal collection, that does not take much space at home, and does not collect dust easily. I made it into wooden puzzles to get rid of molding, painting, and assembly cost. Then I further simplify the assembly to make it a suitable science project for kids.

Purpose of this instructable: To make easy-to-biuild personal 3D zoetropes

For makers who want to build one for fun or for educational purposes, here you’ll find files needed as well as source files for modification purposes. If you have better solutions to make it more maker friendly, please feel free to improve my design and share with others.

For professionals who shares my view to make it a suitable science project for kids or companies interested in making this a product, feel free to take and modify any materials that I provide here for commercial purposes.

For others who simply found this project interesting, please share this link with your friends.

Step 1: Prepare the Wooden Puzzles

You can choose to either laser cut (and engrave) or 3d print the puzzles. Grooves/Slots in this design are 2.8mm in width, which is not too tight nor too loose for 3mm thick plywood sheets. I have not personally laser cut this one, and DXF files generated from Inkscape tend to be in wrong scales, so be sure to check scale before you cut.

For 3D printing, you’ll need a printer that can handle at least 185mm x 185mm. The 5 stl files are set to be 2.6mm thick because plastic printouts are harder than plywood sheets and inner cavities tend to be printed smaller. It may be a good idea to print a few pieces for testing then make adjustments to the thickness accordingly before you proceed to print the whole kit. I divided parts into 6 plates, 2 x plate 5-2 are required.

For people who do not prefer to spend the efforts to build the PCBA, I added a BOXOI2-Lite at the end of this instructable. However, here is the catch, you’ll need a good (maybe high-end) smartphone with a strobe light app as a substitute for the LEDs controlled by the PCBA. I personally tried this with my Nokia 3.1. Although the app is set to lit the LED for less than 1ms per (flash) cycle. My phone simply can’t catch up. The result is a blurry animation.

Step 2: Prepare the PCBA

I’m not good with circuit design and programming, the plan was to demonstrate, get funding, then hire someone to redesign the circuit, use cheaper parts (attiny85 may be an overkill for this project), and rewrite the code. My apologies if the schematic and code look ugly.

All parts used in my circuit except for si2302 are THT parts, I think it’ll be more maker friendly and the parts are easier to get. I do think si2303 is very difficult to solder on a perfboard, but it’s doable. They are needed to handle higher current for the TT motor and LEDs, they also cause less voltage drop. You may replace these with other compatible THT mosfets, but the ones I found are too big and kinda overkill.

You can export BOM from the Fritzing file for shopping purpose. I can’t find TCRT5000 in Fritzing, so I use a phototransistor and an ir led to make footprint. Please ignore these two parts and find a TCRT5000 instead.

If you want to build this circuit on a perfboard (I tested it on a 5×7 cm board), be sure to measure the position for TCRT5000 before you start soldering. As shown in the photo above, there’s little tolerance under the platform for such big PCB, and the TCRT5000 has to go through a square hole on the platform. An easier approach is to make a TCRT5000 breakout board.

After the PCBA is completed, run Arduino and upload the sketch with ICSP. If you have no clue what this means, check online for tutorials about “programming stand alone Attiny85 with Arduino using ICSP”. You can also upload the sketch using a breadboard if you don’t have an AVR programmer. In that case, use a 8 pin socket instead of soldering Attiny85 on your PCB will be a good idea.

Step 3: Prepare Other Electric Parts, Nuts, and Bolts

  1. One TT motor (3~6V, reduction ratio 1:48; ) – BOXOI runs roughly about 12 fps frame rate. So we need this motor to run 2~3 rps. (120~180 rpm)
  2. One B type 15mm shaft potentiometer 100K ohm
  3. One cap for the potentiometer (optional)
  4. One 2 pins push button switch (red, m7)
  5. One battery box (AA*3)
  6. LED x2 (either build PCBA versions with LED module 01.fzz or buy the 1W LEDs with aluminum plates)
  7. m3 x25mm hex bolts and nuts x4 sets
  8. PP round spacer φ5x 6~7mm(L) x2 (or make 2 with a 3D printer using the round spacer.stl)
  9. Some double sided foam tape to attach battery box and PCBA to the platform
  10. One O-shape PET sticker (or replace this with some packaging tape)
  11. Some wires with connectors

* Wires with connectors are to be solders to item 1,2,4,5,6.

Step 4: Build a Blank Play Disk

If the disk is 3D printed or laser cut without engraving, a piece of dark duct tape will do the trick.The dark stripe doesn’t have to be as wide as shown, about 1cm will do.

Step 5: Make the Ponies

  1. Find yourself 3 parts with the same number, and 2 M-shaped puzzles
  2. All markings point forward (All numbers are closer to the tail)
  3. The markings on the leg parts are on the outside
  4. Finish all 6 ponies

Source: BOXOI – an Open Source Miniature 3D Zoetrope DIY Kit

Click Brick Switch for Makey Makey

$
0
0

This 3D printed switch will allow the user to turn a Makey Makey into a “finger slide” for a “click” in gaming or could be right/left arrows to scroll through presentations. The addition of right and left terminal mounts for the ground wire makes it flexible to meet the hand dominance needs of the user.

Supplies:

What you will need:

  • Makey Makey invention kit, including USB and alligator clips.
  • 3D printed parts, see Thingiverse files for Click Brick Base and Finger Slide https://www.thingiverse.com/thing:4321525
  • one, flat head #4 wood screw 1.5-1.75 inches
  • two jumbo paper clips and pliers for bending

Step 1: Prepare Paper Clips

1. In order for the screw to make clean contact with the paper clips, bend the smaller, center part of the paper clips about 90 degrees.

Step 2: Installing Contacts

  • After you’ve acquired both 3d printed parts, install the screw so that the head is in the center of the “finger cradle” and the point is coming out of the flat part of the slide.
  • Use a pliers to install the paper clip into the slots with the bent part facing the center of the cube.

Step 3: Connect to Your Makey Makey

  • Depending on the user, connect the right or left terminal (cylinder form) on the Click Brick with an alligator to Earth on Makey Makey to ground your circuit.
  • Decide if your use would be for single click or right/left arrows.
  • If using mouse click, use one alligator to connect “click” on Makey Makey to one paper clip.
  • If using right/left arrows, use one alligator clip per paper clip (one on either side of Click Brick) to connect right and left arrows of Makey Makey to each paper clip.

Step 4: Enjoy Playing Your Favorite Scratch Game or Scrolling Through Your Next Presentation.

Be sure to rest your thumb on the ground (Earth) clip to complete your circuit.

Source: Click Brick Switch for Makey Makey

WiFi LED Switch IoT

$
0
0

The main aim of this project is to come up with a functional WiFi switch that will help us operate via the “Blynk” app from the Mobile app store.

This Instructable is successfully tested with very basic knowledge of Electronics and I would appreciate suggestions from professionals in the domain to comment for appropriate changes.

Supplies:

The following components are required to successfully complete the project

  1. NodeMCU
  2. White LEDs – 10 Nos
  3. Multimeter
  4. Soldering Iron
  5. Soldering Lead
  6. Soldering Flux

Step 1: WiFi LED Switch Using NodeMCU & Blynk

The very first step is to check and lineup LEDs in accordance with their polarity (Anode & Cathode lined up for easy identification)

There may be a few LEDs that may nor be functional, hence it is always suggested to check each one of the LEDs using Multimeter.

Step 2: Identifying & Soldering Working LEDs

Continuity check using Multimeter will help us identify the functional LEDs and the faulty ones.

It is always better to tape the LEDs WRT their polarity and make them ready to be soldered.

On completion of soldering all 10 LEDs, it is once again suggested to check the continuity using a multimeter.

LED is functional only if the positive lead of the multimeter when connected to the Anode and the negative lead of the multimer to the Cathode helps the LED mildly glow.

On completion of soldering all LEDs, we can primarily check if all the LEDs are glowing with help of a 9V Battery (Connections to be made keeping Polarity in mind)

Note: If there is a failure LED, you may see something similar to one of the images uploaded where the Multimeter displays a value of 1607.

Step 3: Connecting NodeMCU & Uploading the Code Via Arduino IDE.

Packaging the prototype is important and I found a “Solid State Drive (SSD)” packaging tray to be most appropriate to package the soldered LEDs and NodeMCU.

The connections are very simple and are as follows:

1. Connect “D1” pin of NodeMCU to the Anode of soldered LEDs and

2. Connect the “GND” pin of NodeMCU to the Cathode of soldered LEDs.

Note: Please refer to the attached screenshot for the complete code. It seems some portion of code is missing, especially with the “include” statements while placing the subsequent text in between less than and greater than symbols.

Upload the following code to NodeMCU:

#define BLYNK_PRINT Serial

#include ESP8266WiFi.h

#include BlynkSimpleEsp8266.h

char auth[] = “**************************************************”;

// Your WiFi credentials.

// Set password to “” for open networks.

char ssid[] = “************”;

char pass[] = “*****************************”;

void setup()
{

// Debug console

Serial.begin(9600);

Blynk.begin(auth, ssid, pass);
// You can also specify server:

// Blynk.begin(auth, ssid, pass, “blynk-cloud.com”, 80);

// Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8080);

}

void loop()
{

Blynk.run();

}

Step 4: Blynk – Configuration & Testing.

Finally, it is time to configure and test the prototype functionality using the mobile application “Blynk”.

Please take the necessary help from the attached screenshots to complete and run the prototype successfully.

The following step by step instructions will help the reader of this article:

  1. Install and open the Blynk App on mobile.
  2. Give the project a name: “WiFi LED Switch IoT” in this case. You may choose your own terminology to name it.
  3. From the drop-down list, choose the device using which the experiment is completed.
  4. On selecting “Create”, an “Authorization Token” is shared with the registered/configured Email ID.
  5. It is now time to add components to the project. We will need only one “Button” in this case.
  6. Furthermore, the button “Output” setting needs to be changed to indicate the Digital pin on which the LED in series is connected (D1 in this case).
  7. Continue to configure mode to “Switch” to complete the configuration.
  8. Choose a convenient location for the “Button” to be placed on the dashboard and select the “Play” button at the top right corner of the interface to start interacting with the board.
  9. You should now be able to control your LEDs in series from anywhere & any time.

In case of any further help, you may WhatsApp me on +91 9398472594.

Source: WiFi LED Switch IoT

BBC Micro:bit and Scratch – Interactive Steering Wheel & Driving Game

$
0
0

One of my class assignments this week is to use the BBC Micro:bit to interface with a Scratch program we’ve written. I thought that this was the perfect opportunity to use my ThreadBoard to create an embedded system! My inspiration for the scratch program comes from vintage handheld electronic games that my mother would get for me and my brother from the Goodwill or the corner store. I have many fond memories of those dusty LCDs, discolored plastic casings, and buttons that would mysteriously stick when pressed. I particularly remember the racing games that we would play (e.g. figure 2) where you could only shift between two lanes to dodge oncoming cars. In the spirit of revisiting my youth, I’ve recreated this type of game in Scratch.

The Micro:bit’s accelerometer is used to control the steering of the car, and the two switches are used to control the car’s horn. Scratch is used to play the driving game, titled: BBC Micro Driver.

The project page can be found here: https://scratch.mit.edu/projects/428740218/

If you have any questions, want to keep up with my work, or just toss around ideas, please do so on my Twitter: @4Eyes6Senses. Thanks!

The music in the video was provided by Vincent Haney.

Step 1: Materials

ThreadBoard – Link

BBC Micro:bit – Link – Follow these instructions to connect your microcontroller to Scratch

4mm (Diameter) x 3mm (Height) magnets – Link

Foam sheets – Link

Stainless steel conductive thread – Link

A Scratch account – Link

Tape

Step 2: Adding Magnets to Your Micro:bit Pins

Now that you have the materials it’s time to add magnets to the five Micro:bit pins. The reason we are adding magnets to the pins is to (1) hold the Micro:bit securely to the magnet enriched ThreadBoard and to (2) allow for the easy connection between the pins and the conductive thread. Typically, to connect the Micro:bit with conductive thread you would need to sew and secure the thread around the open pins, and if you wanted to change your design you’d need to cut the thread attached to the Micro:bit and possibly resew your project. With the ThreadBoard you can simply drop your conductive thread on top of the magnets and they will keep the thread secure to the Micro:bit pins and the ThreadBoard.

– Isolate one disk magnet from the set. Make sure that you have identified which end of the magnet will attract or repel the other magnets, the poles of the five magnets need to be the same so that they are attracted to the magnets that will be embedded into the ThreadBoard.

– Gently push the magnet through the pin until it is secured. The magnet at this point should be crooked in the pin and will detach if placed on a metallic surface and pulled. Continue this process for the next four magnets.

– Using pliers or a flat surface, apply light pressure on the bottom of the magnets until they are secured in the pins and sit even. If at any point you want to remove the magnets, apply light pressure on the top and they’ll pop out easily.

Step 3: Create the Controller

Once you have your materials, I suggest you start with wiring the two switches. The way the switches work is that you place a ground wire around the outer halo of the ThreadBoard, where your hands will hold the controller. Then, when your fingers touch the wires connected to the ThreadBoard’s “0” or “2” pins you will bridge the connection and cause the car to honk. Here are the steps:

– Place the conductive thread on the outermost ring of magnets and then place the thread on the “GND” pin of the Micro:bit (Figure 1).

– For the left button, place one end of the conductive thread on the “0” pin of the Micro:bit. Create a trail to the left and place the end where you want the button. Grab your cut foam and thread it with the conductive thread (Figure 2), once you know where you want to place the button, secure the foam and thread with one of your extra magnets (Figure 3).

– For the right button, place a small piece of tape over the thread connected to “GND” (Figure 4) this will isolate the two wires and avoid causing a short. then follow the same steps as the left button.

Step 4: Create the Program

The link for the project can be found here: https://scratch.mit.edu/projects/428740218/. The code is broken into three parts: the user’s car, car 1 (the blue car), and car 2 (the red car). Car 1 & 2’s code is relatively the same, just with different x and y coordinates and a different “wait” function.

– User’s car (Figure 1): When the user presses the green flag/start button their car will start at a predetermined position. when the user tilts the controller left or right the micro:bit will display the direction, and the program will move the user’s sprite to either the left or right side of the road. When the user presses the switch on the controller the car will make either a car horn or clown honk (depending on if they press the left or right button), this will also cause the car’s tail lights to turn on (switch costume). When the car crashes with another car (this is handled in the car 1 and car 2 code) the backdrop will switch to the game over screen and the user’s car will disappear.

Car 1 & car 2 (Figures 2 & 3): When the user presses the green flag/start button, the score is reset to 0 and the game over screen switched to the main highway scene. The “repeat until” loop makes sure that cars are continuously generated as the user plays. The car is placed at the top and “glides” down the screen at a random interval ranging from 1 to 5 or 10 seconds (depending on the car). The if statement checks if there’s a collision between the user’s car and car 1 or 2, if yes, then we switch the backdrop to the game over screen and end the game. if there isn’t a collision, then we add 1 to the user’s score and the car disappears off the bottom of the screen.

Source: BBC Micro:bit and Scratch – Interactive Steering Wheel & Driving Game

Viewing all 1082 articles
Browse latest View live