Search for shift register in Topics


Shift Register and Relays? Answered

Using a 74hc595 shift register to a ULN2003 darlington array to control 7 relays, all controlled by an MSP430, connected via RJ11.  The relays are controlling LED Christmas light strings on and off.  Everything seems to be functioning so far but the problem is that relays that aren't being told to turn on sometimes are turning on.  The shift register is connceted with Qa to the master reset of the register so I can clear is quickly, but so far I have been just leaving it high.the other 7 outputs (Qb - Qh) connected to the base pins of the ULN2003 (B1 - B7).  The outputs of the ULN2003 connected to the relay coils, COM connected to 5v, emitter connected to ground.  I have tried pull down resistors on the base pins, I have tried tweaking the code which I tried to set up to just bit bang the shift register, make it as simple as possible just to test it and a sample is provided below for one iteration.  I have it looping through several of these to turn a single channel on each time to check to make sure all the channels work.  It however sometime make a channel just flicker, not turn on at all, or turns several channels on at the same time.  I am curious as to whether this is a hardware problem (pullup/down resistors, filtering caps, more clamping diodes then what is built into the ULN2003, whatever) or whether I am just an incompetent programmer.  I am fairly certain the problem lies somewhere between the driver seat and the steering wheel though.  One thought I had but do not want to try right away is it possible the shift register is bad?  Overheated from soldering?  I try to solder one pin on chips, then a pin on another component, then a pin on the opposite side of the chip, etc to keep chips cool when soldering them, but are the 74hc595 very heat sensitive maybe?  Would appreciate a fast answer, looking to build 5 more of these so I can control all my Christmas lights. This was supposed to be a cheap and dirty project so I didn't get into Triacs and dimming, I just want to turn lights on and off as I see fit.   i = 30000;   P1OUT = 0x00;        //Channel 7 (unused)   P1OUT |= 0x02;       //Clock in   P1OUT &=~ 0x02;   //Clock low   P1OUT = 0x01;        //Channel 6 (Green Wreath)   P1OUT |= 0x02;       //Clock in   P1OUT &=~ 0x02;   //Clock low   P1OUT = 0x00;        //Channel 5 (Red Icicle)   P1OUT |= 0x02;       //Clock in   P1OUT &=~ 0x02;   //Clock low   P1OUT = 0x00;        //Channel 4 (White North)   P1OUT |= 0x02;       //Clock in   P1OUT &=~ 0x02;   //Clock low   P1OUT = 0x00;        //Channel 3 (White South)   P1OUT |= 0x02;       //Clock in   P1OUT &=~ 0x02;   //Clock low   P1OUT = 0x00;        //Channel 2 (Blue North)   P1OUT |= 0x02;       //Clock in   P1OUT &=~ 0x02;   //Clock low   P1OUT = 0x00;        //Channel 1 (Blue South)   P1OUT |= 0x02;       //Clock in   P1OUT &=~ 0x02;   //Clock low   P1OUT = 0x01;        //Channel 0 (Clear All/Active Low)   P1OUT |= 0x02;       //Clock in   P1OUT &=~ 0x02;   //Clock low   P1OUT |= 0x04;       //Latch outputs   P1OUT &=~ 0x04;   //Latch low   while(i > 0)   {         i--;   }

Question by Electric Spectre1    |  last reply


Pesky shift registers? Answered

I started working with 2 74HC595N to control 8x8 matrix, and found that instead of a dot it activates multiple rows. So I assumed this was due to my lack of knowledge about shift registers so I setup a simple scenario from arduino ShiftOut tutorial (single register chip and 4 LEDs controlled by number via serial input i.e. "one by one sketch". Thats when I found out that shift register has almost random values on its output pins. Some LEDs were on, some off before I started to controll them. After I turned on/off all 4 it strated to work as supposed to, but last pin retained "memory" of its state even if I reset Arduino.  So my question is, do I always need to initialize every pin of every shift register (and is there an example sketch), or do I have faulty IC? Edit: Added schematic (it's from http://arduino.cc/en/Tutorial/ShiftOut)

Question by bratan    |  last reply


LED sink driver and Arduino question.?

Hi ... I would like to ask, if I can use 2 of these LED sink drivers uk.farnell.com/jsp/search/productdetail.jsp by using/controlling them just from 3 pins on my Arduino ??? I think, that it should be possible thanks to the pin22 SDO (datasheet www.farnell.com/datasheets/456099.pdf) ... what do you think ??? If yes, is there any limitation on HOW MANY shift registers/LED drivers you can connect "in a row" by using just 3 pins on Arduino ??? Could I use 4 of these drivers and control them just by 3 pins on Arduino ??? Thank you in advance for your answers...zholy

Question by zholy    |  last reply


How to control 100 bidirectional DC motors?

Hi,  I'm trying to control 100 DC motors using a microcontroller (Arduino Mega) The motors run on 1.5V and have a operational current of 40mA. 1) Each motor must be able to rotate clockwise and counter clockwise 2) The motors must be able to move independently     (though direction of the motors at any one time will be the same)      eg. at time = 0; motor 1,20, 30, 45 will rotate CW            at time = 10; motor 20, 35, 80 will rotate CCW 3) Using minimum amount of pins from the Arduino (Shift Register ?) How should i go about doing this ? I have tried using L293D H-Bridge, but in order to control 100 motors,  i will need 50 H-Bridges and 200 digital output pins I'm thinking of a simpler circuitry (image attached) to control the motors. Digital output pins from the Arduino will contol the relay switches, and the DPDT relay will change the polarity of the the voltage supply. Will this work ?  Are there any smaller alternatives to the mechanical relay (transistor ?)  Can a transistor allow current flow in both directions ? I would really appreciate if you could provide some inputs and ideas as to how you would go about controlling a large amount of motors. Cheers!

Question by fujiapple    |  last reply


Shift register too slow for multiplexing?

Hi, I'm trying to figure out working with shift registers. I bought a couple of 74HCT4094's, hooked them up through my breadboard to a small matrix with some LEDs and my Arduino. Without multiplexing everything works fine, but no matter what circuit I build (changing wires, resistors, transistors, even the Arduino code), when I start to multiplex the LEDS clearly 'flicker' (is that the correct term?). Is it possible that some shift registers are 'too slow' for multiplexing with Arduino?

Topic by Huibgeboers    |  last reply


Combinational Lock using shift registers

Last year, i made the circuit of this already but now my brother is asking for my help and i cannot remember it now. im focusing right now in programming and forgot my logic circuit skills..please help me to remember this... what i remembered is that i have shift registers that memorized the buttons (0-9) i pressed...then i enter again a sequence of numbers and the device will check if it corresponds to the numbers i entered...the led will light if it is correct and will not if the numbers entered did not match the default numbers... i still have the list of some materials, 3 universal shift registers, 1 nand ic, 3 xnor ic, 10 toggle switch and 1 hold switch..  its not a very complex circuit..my only problem is to remember on how will i work with the shift registers... please enlighten me once again

Topic by eaon21    |  last reply


Shift Registers vs LED Drivers?

I am trying to figure out how to program an arduino to control LEDs. Basically, what I have done, is I have made a 3x3 matrix and can program some simple sequences with the LEDs using the digitalWrite and delay functions.  I'm not even sure that this is the right way to do this, I don't think it is, but it works.  Anyway I want to try to program bigger matrices and maybe LED cubes using my arduino, but without using up all of the output pins. So, I've came across two ways to get more outputs from less pins; LED drivers and shift registers.  These may be the same thing and I'm just not aware.  But anyway, is there a difference between them? I've really only found information about shift registers, nothing really about LED drivers.  Is one easier to program? Does one use less pins than the other? Or are they just the same thing?

Question by texpert    |  last reply


Re-purposing a scanner CCD into an analog shift register

How tough would it be to do that? Based on the research I've done so far, That could be one hell of a challenge for a noob like me. Knowing that, is there a part (preferably 8-bit and has lots of inputs/outputs) that would do the same thing for me? This will be used in a similar fashion as a CCD sensor setup, but light isn't the medium I want to measure

Question by The Ideanator    |  last reply


I Need a little Help with Shift Registers

Hello, I'm both new to Instructables, and electronics in general. I'm trying to make a Divergence Meter, but I'm using LED's instead of nixie tubes. (It's safer for having my little cousins around.) I'm hoping to control each tube with one shift register per tube. Each tube will have 11 imputs and 1 output. I was curious if you guys had any tips on how to do that with the standard 16 pin registers, or if you could direct me to one that could do it. Thanks.

Topic by Glyngsdal_inovations  


I Need a Little Help with Shift Registers

Hello, I'm both new to Instructables, and Electronics in general. I'm trying to make a Divergence Meter, but I'm going to be using LED's and etched acrylic instead of Nixie tubes. (It's safer for having my little cousins around.) I'm hoping to control each tube with one shift register per tube. Each tube will have 11 inputs and 1 output (11 LED's 0402 type). I was curious if you guys had any tips on how to do that with the standard 16 pin registers, or if you could direct me to one that could do it. Thanks.

Topic by Glyngsdal_inovations    |  last reply


How to drive serial data via (shift registers) AVR?

Is there some sort of code that will allow easy serial data tranfser from an AVR to a shift register (specifically the max6921 driver)? Thanks

Topic by guyfrom7up    |  last reply


Chaining 4 74HC595 shift registers together

I have a question about chaining 4 shift registers together.I am going to be sending data to four shift registers and my question is this, when all four are loaded and latched if I send more data is it possible to only send data to the first register in the chain without the others losing their values?

Topic by mbcharney    |  last reply


Can a shift register be too slow for multiplexing?

Hi, I'm trying to figure out working with shift registers. I bought a couple of 74HCT4094's, hooked them up through my breadboard to a small matrix with some LEDs and my Arduino. Without multiplexing everything works fine, but no matter what circuit I build (changing wires, resistors, transistors, even the Arduino code), when I start to multiplex the LEDS clearly 'flicker' (is that the correct term?). Is it possible that some shift registers are 'too slow' for multiplexing with Arduino?

Question by Huibgeboers    |  last reply


Which pins are which on a shift register? What pins on a 74HC595 shift register are the data, clock, and latch pins? Answered

I just bought an arduino and was trying to do this tutorial https://www.instructables.com/id/Arduino-Expermentation-Kit-How-to-get-Started-wi/step7/8-More-Leds-74HC595-Shift-Register-CIRC05/ . I have hit some trouble though and I am confused when it comes to the shift registers. When he says to connect to the clock pin, do we connect to the SCK (Shift Register Clock Input) or the RCK (Storage Register Clock Input)? When he says to connect to the data pin, do you connect to the SI (Serial Data Input)? Also what does he mean when you say to connect to the latch pin? The data sheet for the Digikey shift register I am using is in the link below.http://www.fairchildsemi.com/ds/MM/MM74HC595.pdf?

Question by Stoned    |  last reply


Arduino Vu meter/Mood light?

Hello There :) I have this concept: A wall to ceiling light that consists of several segments that are lit with rgb leds. I want it to have two modes - VU meter mode and rgb mode (goes through rainbow of colours) I know how to do each separately: -VU meter - There is an instructable I can follow -RGB mode -Using shift registers etc.. But I don't know how to incorporate them together. Can I use a shift register and an arduino (through PWM) to give functionality of both settings I would like? Thanks, Joe

Question by joearkay    |  last reply


Wiring a wav playing setup and shift register to the same arduino?

I just ran into an issue with my current setup for a project I've been working on. I would like to hookup a wav playing setup (either the Adafruit Wave Shield or a wav playing setup like this) Issue I'm having is I can't change the pins around for the shift register setup (which I have setup and working just like I like!).  I know this is probably a stupid question (what with stacking shields for the uno) but could I wire up multiple items to the same pin? IE wire pin 12 to both a shift register and a wav playing setup? If not, is there some way around this that would work on a micro that would not mean having to jump to a mega. Thanks!

Question by DoctorWoo  


Faint LED's while using an Arduino Micro and shift register? Answered

This is more of a "How things work" question, but a question non the less. I have five 595 shift registers hooked up to an arduino micro. Everything is wired correctly, and it all works beautifully on my test bed, all the codes work fine. Only issue is that my LED's are only about half as bright as the sun.. Anyways, I was testing one of my codes at work, and due to the bright, flashing LED's that were popping up on the 595 portion of the board, decided to just power them off but removing the 5v leg going to them (I know, it would have been better to just set in an "all off" in the code, but I figured removing the power pin would work). However, removing the 5v leg to the 595 didn't turn them off: it only made them about a third as bright as they normally are. I checked to ensure that there was no power getting to the 595's, and there is not.  So: why would the LED's connected to the [unpowered] 595's still turn on?

Question by DoctorWoo    |  last reply


Newbie Alert!Is it possible to make a 8x8 led matrix with 74hc595 shift registers w/ arduino?

If so can someone help me with the schematic? And also I'm using an arduino uno r3 if that helps? I kind of would need help with the programming as well. I have transistors (2N3904) and resistors (100 Ohm/200 Ohm) too.  Thanks for the help!

Question by scooter2013    |  last reply


Random flashing LEDs when using shift registers and turning on the system: how to fix? Answered

I have a setup using 5 shift registers (74HC595s) hooked up to an arduino micro. Everything works great! So much so, that I didn't pay too much attention to the start up issue. When I start up the system (either by hooking up a battery or plugging it into a USB socket) the LED's hooked up to the 595's will either turn on according to the last pattern they had, or turn on randomly. I was following the Arduino tutorial for this, and it does state that "The one flaw of this set up is that you end up with the lights turning on to their last state or something arbitrary every time you first power up the circuit before the program starts to run." It also states "You can get around this by controlling the MR and OE pins from your Arduino board too, but this way will work and leave you with more open pins." However, I'm either missing it or it is not outlined how to hook up the MR and OE pins to the setup to correct this. Any help is greatly appreciated! 

Question by DoctorWoo    |  last reply


How do I change this code to account for only 1 shift register?

Hi, I am trying to make a midi keyboard as shown https://www.youtube.com/watch?v=lXX8v-ZW6Tk But I am not sure how to change this section of code to account for only one shift register (as seen at 5:35 of the video above): void scanColumn(int colNum) {   digitalWrite(latchPin, LOW);   if(0 <= colNum && colNum <= 7)   {     shiftOut(dataPin, clockPin, MSBFIRST, B11111111); //right sr     shiftOut(dataPin, clockPin, MSBFIRST, bits[colNum]); //left sr   }   else   {     shiftOut(dataPin, clockPin, MSBFIRST, bits[colNum-8]); //right sr     shiftOut(dataPin, clockPin, MSBFIRST, B11111111); //left sr   }   digitalWrite(latchPin, HIGH); } Can someone help please?!

Question by hbade    |  last reply


Transistors in LED matrices?

I'm confused about the purpose served by using transistors in an LED matrix.  Why not simply use current limiting resistors and a shift register?  What purpose do the transistors serve?

Question by KentaGrace    |  last reply


analog demultiplexing?

Is it a good idea to use just a single DAC to produce 2 or more separate analog outputs? I do not need super fast updating rate, but I do need precision. My DAC is a old but pretty cool looking DAC71, of which I have like a handful. It has a 16 bit parallel interface (which is a REAL PAIN) and a CC output. Placing a small resistor on the output of that gives me a voltage range. To interface it to an arduino, I used two 74C164 shift registers so that I only use 2 pins on the arduino. (one for clock, the other for data). However, the DAC does not have an updating rate, it is kinda analog in that respect. Because of that, you can see all the garbage from the shift register outputs while data is being shifted in. My current solution to this problem was to use a spare TL601 analog switch and a 3rd wire from the arduino to "mask" the updating period when data is being shifted into the registers. This worked well, until the wire popped out and came into contact with +12V rail, killing arduino pin 10. :(  so sad, it was literally a brand new arduino clone... In a similar fashion that the output of a single ignition coil in a car is fed into a distributor to distribute voltage to the correct spark plugs, is it OK to use a few more analog switches to do some interlacing? Are there things that I potentially have not considered? My idea is that after data for, say, output A has been shifted into the 2 registers, the arduino will activate switch A and (through a buffer amp) charge a capacitor up to the same voltage, then turn switch A off while shifting in data for output B, then activating switch B to allow the capacitor to charge up to that voltage, and again the switches turn off to let new data for output A shift in, and the process repeats. The capacitors will "remember" what voltage they held during the off period, as sort of analog memory. I think the updating rate will take a hit, but oh well.

Question by -max-  


stop 7-segment from ghosting?

I'm working on a simple arduino 7 segment driving circuit. (It also has a led bar-graph that displays binary numbers but that part is working fine.) When I get the display working I might make an instructible out of it. Here's the basic layout: -using this 8 segmet 4 digit common cathode display. -arduino controls what segments are on via 74HC164 8-bit Serial Shift Register -shift register controls an array of 8 PNP transistors with base and pull-up resistors -transistors connect to display anodes through resistor array -display cathodes (common for each digit) connected to array of 4 PNP transistors with base and pull-down resistors  -PNP transistors controlled by arduino. (I will post the schematic shortly.) In software, to display a four digit number, I shift the pattern for a given digit to the shift-register, which in turn turns on the PNPs for the corresponding segment anodes. I then turn on the NPN for that digit's cathode. I delay for a few milliseconds, then turn the NPN off, shift the next digit in, and turn the NPN for that digit on. Rinse and repeat. It works fine but the segments that should be off are at about 1/2 brightness, making all the digits look like eights. Even the DP looks like it's on and I'm not turning it on anywhere. Do I need pull-down resistors for the anodes or something? What's going on here?

Question by Vick Jr    |  last reply


Does the method of powering arduino matters? Answered

I ran into a small problem, and was wondering if my assumption was correct and if my solution was right too. When it comes to electronics I am pretty green, so please forgive me. Today I was reading an instructable dealing with Shift Register ([url]https://www.instructables.com/id/The-74HC164-Shift-Register-and-your-Arduino/?ALLSTEPS[/url] ), and came upon a problem. I had problems shifting out different patterns of LEDs. At first I though I had a defective chip. After changing the chip the problem persisted. Next I noticed that if I reset the Arduino a couple of times I would get a correct pattern displayed. I tought that maybe it might be something to do with my power source. I was running my Arduino from the USB. I tried connecting Arduino via my 5v power supply (http://www.sparkfun.com/tutorials/57), and everything started to run smoothly. So the question is. Is the USB power not clean? and that is why I wasnt able to displayed a correct patter or was it something else? Would it be possible to solve this with some other method? Any links on the subject matter would be greatly appreciated. Thank you.

Question by Eax5    |  last reply


16x16 LED panel direct control

Hi all, I got 10 LED panels of 16x16 LEDs each. Now I want to create a big modular display system with these and I'm also planning to post this on the instrucatbles website once I succeed. But I have some problems getting started. I spent alot of time reading all LED matrix related topics on the website here but none of the designs matches the fixed design I have on those panels. Instead of using some sort of multiplexing, 32 shift registers are used for 256 LEDs which means every LED has it's own shift register output. Put then again, I also find 3 buffer ICs on the panels and I have no idea where they are used for... Below the info I have now: 1 PANEL: - 16x16 yellow LEDs - 32x M74HC4094B1 8-bit shift registers - 3x 74HC125N Quad buffer/line register, 3 state Pictures: http://www.myalbum.com/Album=64MKOUJR First I want to work with only 1 panel and be able to control this by putting images on it. But for this I have to understand completely how the hardware is built up so I first want to create the schematic of 1 panel. Can somebody help me with this and get me started on the project? First goal: just control 1 panel with an AVR to put some text on it and let is scroll. Final goal: be able to connect multiple panels and configure the software accordingly to the panels used. Then use a PC to put images on the screen and maybe even create a live feed (webcam capture). For this maybe an FPGA should be used to have more processing power/memory. Many thanks already in advance!

Topic by kris_ge    |  last reply


Need some help with a parts list for a RGB array.?

Im saving up money to build a wall of 512 RGB LED's from a site called solderlab, and they provide real good documentation, and pics, but im still confused on what I need EXACTLY for the PCB boards. There will be 8 with shift registers, and one for power. I will link pictures to the schematics, renders of the boards. And Ive got some, I think. Also where I can get the custom PCB's made, and or, how much they will be! :D  Heres the Power board:  http://www.solderlab.de/images/led-projects/modular-plasma-wall/Mainboard_PCB.png Render of the Power board:  http://www.solderlab.de/images/led-projects/modular-plasma-wall/Mainbord_Top_1.png One of the 8 Shift register boards: http://www.solderlab.de/images/led-projects/modular-plasma-wall/Segment_PCB.png And lastly, The render of The shift register boards: http://www.solderlab.de/images/led-projects/modular-plasma-wall/595_8x8_Top_1.png And as far as I can tell, I need: 36 RJ45 Jacks 32 Shift register 74HC595's base resistors 10k Conrad Electronics 64 npn-transitors BD139 Conrad Electronics 64 34 pin ribbon cable connector 3- 22p ceramic caps And they say ( but im not sure what or where to get them) Pull-Up / Pull-Down resistors 10k     x5 4 x pin header quarz 16MHz (Im assuming this is just a 16 mhz crystal. And two Electr. Caps 100 µF So what am I missing? and how do I make/get those little wire bridges? Thanks! :D Im excited.

Question by 'earl    |  last reply


Aduino Duemillinove and 4 8x8 tri-color LED matrices

Pretty simple. I'm looking to hook up 4 tri-color LED displays to an Arduino. I am sort of of confused with the shift registers. Any help would be appreciated.

Topic by agent    |  last reply


Are there any coding wizards around when I need them?

I'm sorry to ask a total newb question... but I'm a total newb to shift registers being used with my arduino and 8x8 led matrices. Would somebody be willing to help me make the code in THIS example so that I can use cascaded 595 shift registers to make for less pin usage on my arduino? Thank you! EDIT: I'm using an Arduino Duemilanove with pin 8 to LATCH, 11 to Serial Data input, and 12 to storage register clock going into two cascaded 595 chips. My displays are 8x8 dual color LED, common cathode, and I've only wired up the red for the time being. Also, I'm VERY bad at coding. If there's a code, I can read it, but it's like a foreign language whereas I'm better at understanding than reading and writing. I'm sorry :/ I think I need more help understanding how to plug "shiftout" where "datawrite" would be and how to get it all working.

Question by Franktea    |  last reply


Got a problem with the Arduino shift out function and a LED array

After looking at this instructable, I wanted to start building my own LED array. I found this Arduino article. I bought the 74HC595N chips and connected everything exactly as the article showed it, and copied the first example program directly into the Arduino. The Arduino is connected through the USB cable to my computer for power. My problem comes in when I hook the circuit into the 5V on the Arduino. When I hook it up the Arduino shuts itself off. I wasn't sure if it was overloading the Arduino, so I hooked it up to an old, plug in breadboard I have which has a limit of 1.5A. When I hooked up the circuit the breadboard produced a high pitch tone and still nothing happened. I have checked and rechecked all the connections and jumpers, (even looked at the data sheet for the part) everything seems to check out. The LED's are just simple green LED's, but the resistors I am using are 1k instead of the 220 ohms the article said to use (i had only 1k handy and the LED's still light with a 1k).

Question by Mitnick22    |  last reply


How a Transistor connected to 12v and out 4.7v !!!!!!? Answered

Hello All, I have a problem with a circuit i am building, I use a 2N2222 transistor to drive a Common Cathode big 7 Segment  with a 595 shift register.. I connected a 12v to Emitter, the collector out a 4.7 volts !! How is this possible ? could some one explain please ? Thanks all

Question by EZELab    |  last reply


red 8x8 matrix with 26 pins?

I received this matrix in the mail and I'm having problems trying to get it wired, as you can see it's it has 26 pins, the schematic has 8 pins for the rows and 8 pins for the columns but the other 10 are sitting at the bottom with the words "no pin"? I tried to wire up the rows and columns but had no success. My main goal was to have it hooked up to a couple 74HC595 shift registers (via 16 pins?) on some protoboard. Any help on how to get this wired would be appreciated!

Question by whiskey_14    |  last reply


Do you know what is the proper name for this lights ???

Hello ... do you know what is the proper word for these lights : www.youtube.com/watch I would like to find the scheme for it and which microcontroller is used for these lights. I know, that I would be able to do this with arduino + shift registers ... but that would be too expensive for my idea = I was thinking about creating a "neuron net"  Today I saw it in ZARA (shop with "clothes") but when I asked them, where they got it from ... they said from Spain - from their "headquarter" :( Thanks ... Zholy

Question by zholy    |  last reply


STATIC LED DISPLAY MESSAGE

My name is Simon Njoroge. I have successfully made a 9(rows) x 24(columns) LED display panel that displays a scrolling message that uses the attached code. The panel consists of course of LEDs, 3 shift registers, a 4017 decade counter together with transistors and resistors. However, I would like the panel to display a static message of a maximum of 7 characters for my project need. Kindly can someone edit the code for me? I followed the instructions from the following site:https://www.instructables.com/id/Make-a-24X6-LED-matrix/

Topic by NJORO1975    |  last reply


2 uln2003 stepper drivers linked

Lots of build yer own stepper motor driver boards here. CNC also but, I  have these little ULN2003 driver boards that come with the small BLJ steppers...you do too.  I've seen linking 2 SF easy steppers together but, those cost. anyone know how to tie these cheapy driver boards together-to drive 2 stepper motors with few  /fewer pins from the microcontroller to drive 'em? would some sort of shift register arrangement be in play here?

Topic by schel    |  last reply


Will this circuit work?

Ok, so I'm building a giant led array and I'm running it off of a PWM chip and a few shift registers. Given the number of addresses and variables I need for each one, I'm guessing that the micro running the show won't like that too much and will be a bit slower than I'd like, and i'm not sure if it will be slow enough to cause irritating visual inconsistencies. This got me thinking, how did tube TVs do it? They had phosphors that slowly released their charge and therefor looked alright. Thats how I arrived at this circuit. Will it pretend to be a phosphor well enough or will it need something different?

Question by The Ideanator    |  last reply


Circuitry help needed!

So I'm working on a project to build a binary clock style watch. I have found a fairly simple system to replicate though I plan to downsize the circuit to fit within roughly a 40x40mm area, the height I am not too concerned about right now. Here is the link to the project I plan to replicate:https://www.instructables.com/id/Simple-Binary-Clo...Now with the circuit presented I plan to break it into two boards(possibly three). The top board would utilize 2.8x3.2mm LED chips and connect them properly for the ATtiny and shift register. The second board would house the resistors, ATtiny, shift register, and buttons. It would connect to the LED board via vertical wires that would pass through the LED board and hold it directly above. On the bottom of the second board would be the battery holder and wires to directly connect the positive and negative leads to the needed inputs from the backside of the board. This would result in the second and third boards being back to back. (And I do plan on designing and etching my own boards for this project)So my questions for you are:I want to add a 16.000 Mhz crystal oscillator to the circuit to increase the accuracy of the internal clock of the ATtiny, so where would I add it in?How could I reduce the output power from the battery to run the system on minimal power so that my battery can last a year or longer?And is there such thing as a dual sided pre-sensitized pcb board I could use to make the circuits?

Question by Tman179    |  last reply


URGENT HELP FOR ATMEGA32?

I write c code for lcd and ketpad interface but when i run simulation it detect value from keypad but not show detected value here is code! /* * my_kp.c * * Created: 1/19/2014 5:23:42 PM *  Author: ALEES GEE! */ #include #include #include "IncLcd.h" #define KEY_PRT PORTC #define KEY_DDR DDRC #define KEY_PIN PINC void delay_ms() { _delay_ms(20); } unsigned char keypad[4][4] ={ '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'}; int main(void) { unsigned char collloc, rowloc, data; DDRA = 0xff; DDRB = 0x0ff; KEY_DDR = 0XF0; KEY_PRT = 0XFF; while(1) {   do   {    KEY_PRT &= 0x0F;    collloc = (KEY_PIN & 0x0F);   } while (collloc != 0x0F);   do   {    do    {     delay_ms();     collloc = (KEY_PIN & 0x0F);    } while (collloc == 0x0F);       delay_ms();    collloc = (KEY_PIN & 0x0F);   } while (collloc == 0x0F);   while (1)   {    KEY_PRT = 0xEF;    collloc = (KEY_PIN & 0x0F);    if (collloc != 0x0F)    {     rowloc = 0;     break;    }    KEY_PRT = 0xDF;    collloc = (KEY_PIN & 0x0F);       if (collloc != 0x0F)    {     rowloc = 1;     break;    }    KEY_PRT = 0xBF;    collloc = (KEY_PIN & 0x0F);    if (collloc != 0x0F)    {     rowloc = 2;     break;    }    KEY_PRT = 0x7F;    collloc = (KEY_PIN & 0x0F);    rowloc = 3;    break;   }   if (collloc == 0x0E)   {    data = (keypad[rowloc][0]);    LCD_init();    set2();    LCD_SendData(data);     // write first lcd line    wrcomm();   }    else if(collloc == 0x0D)   {    data = (keypad[rowloc][1]);    LCD_init();    set2();    LCD_SendData(data);     // write first lcd line    wrcomm();   }    else if(collloc == 0x0B)   { data = (keypad[rowloc][2]);    LCD_init();    set2();    LCD_SendData(data);     // write first lcd line    wrcomm();   }    else    data = (keypad[rowloc][3]);    LCD_init();    set2();    LCD_SendData(data);     // write first lcd line    wrcomm();   } return 0; } and here is lcd .h code /* * IncLcd.h * * Created: 1/5/2014 4:23:30 PM *  Author: ALEES GEE! */ #include #ifndef INCLCD_H_ #define INCLCD_H_ #include #include #define dataport PORTA              //define port B ATMEGA16 as dataport #define commport PORTB            //define port D ATMEGA16 as communication / control port #define rs PB0                  //define Pin D4 (Pin no.18) ATMEGA16 as RS control #define wr PB1                  //define Pin D5 (Pin no.19) ATMEGA16 as WR control #define en PB2 ////LCD Initialization/// int LCD_init() { dataport=0x38;    // initialize lcd 2 lines, 5x7 matrix wrcomm();        // right the command byte to a command register dataport = 0x01; // clear the lcd wrcomm();         // right the command byte to a command register dataport = 0x0E;  //display the blinking cursor wrcomm();         // right the command byte to a command register dataport = 0x80;  // cursor at line 1, position 1 wrcomm();         // right the command byte to a command register dataport=0x1C;    //shift entire display to right wrcomm();         // right the command byte to a command register return 1; } //setting1 void set1() { dataport = 0xC0; } //setting2 void set2() { dataport = 0x01; } /////sending data to lcd display//// int LCD_SendData(unsigned char s) { //unsigned char *j=s;   dataport=s;   wrdata(); return 1; } ///righting the command byte to command register/// int wrcomm(void) { commport &=~(1 << rs); //setting rs=0; selecting comand register//0 for command commport &=~(1 << wr); //setting wr=0; selecting comand register//0 for write the data to lcd commport |=(1 << en); // EN = 1 lcd access enabling commport &=~(1 < _delay_ms(20); dataport = 0x01; return 1; } ///righting the databyte to data register/// int wrdata(void) { commport |=(1 << rs); //setting rs=1; selecting command register commport &=~(1 << wr); //setting wr=0; selecting command register commport |=(1 << en); // EN = 1 commport &=~(1 < _delay_ms(300); return 1; } #endif /* INCLCD_H_ */

Question by leoroot    |  last reply


Question about LED matrix in general - how odes it work ??? Answered

Hi ... I had a look at this instructable www.instructables.com/id/LED-matrix-using-shift-registers/  and there is this picture with the schematic how to create the matrix www.instructables.com/files/deriv/FSW/VO3F/FHAVXXA0/FSWVO3FFHAVXXA0.MEDIUM.jpg My question is how does it work, because I can't understand it. I'll give an example : Imagine, you turn on 4 leds : LED1, LED8, LED57, LED64. And my question is, how are you going to turn OFF just ONE LED without affecting other LED's ??? When I'm looking at the schematic and I'm trying to TURN OFF LED 1 ... well if I turn off the ROW1 then I automatically switch off the LED8 as well...or NOT ??? Am I missing something or am I right ??? Thank you

Question by zholy    |  last reply


Arduino 5x9 led display and 0-10V voltmeter. Answered

Arduino Duemilanove ATmega328 I want to make a 5x9 led display that monitors a 0-9.99VDC source for a huge motor. I would like to display up to a hundredth of a volt. I would like to do this all using 1 board. I plan on having it display the 3 digits using the 5x9 led display. Can I do this with the limited pins I have without using a shift register? (I think thats what it is called) Do I have all that I need? I have some knowledge of electronics but am in the learning stage but this project will help me a lot in my everyday life. This will be used to monitor a DC water turbine for my pool. I have: -tons of LEDS -Arduino -tons of resistors

Question by newrev426    |  last reply


Need help building a scoreboard with arduino 101 and 12v LED strips

SOS HELPP! Im trying to build a scoreboard with 12v led strips, large digit drivers shift registers (TPIC6C596) and arduino 101 but im not sure how to build it. i have used this drivers before in a 4 digit  clock and the drivers based on another project i saw here in this page, but im not sure if i can use them for the scoreboard.This arduino 101 has a bluetooth componet integrated and im planning on using it to control the scoreboar via bluetooth but if can come out with an other idea it will be great, but i have very limited time and parts and im kind of new to arduino and the whole poject stuff. if you can help me with anything ill be very thankful.. here its the link for the drivers https://www.sparkfun.com/products/13279

Topic by kahboni    |  last reply


Led Clock Feasibility - my first arduino project

Hi guys and good morning all from a total newbie to this world. The aim of this post is to ask you guys if i'm going the right direction to master the knowledge to build my project. To cut a long story short, my plan is to build a clock mixing the old style design of reclaimed pallets with a touch of modernity using LEDs to mark hours , minutes and seconds. The aim is to keep all the lights ON once the given time has passed. To be clearer, if the minutes are "18" i would like all the previous leds (0 to 17) to be all on. I'm pretty sure that the knowledge to build this resides in mastering Charlieplexing and Shift Registering (please correct me if i'm wrong). So at this point in time, i know what i have to "study" to give life to my project the way it's designed in my mind. I've already seen some clocks working this way, hence i'm pretty sure it can be done (happy days!). Point is that i've only seen clocks where this design is achieved with only 1 row of leds. My aim is to swith on 4 rows at any Tn time. So, for the minutes, once it reaches 59, i should have 59 * 4 = 236 LEDs ON simultaneously (for the minutes only... plus N for the hours). Can anyone point me to the right knowledge to be mastered to achieve this? I'm assuming is a problem of sustainable voltage (resistors, power supplies etc etc) leds in paralel/serial; multiple shift registers and so on so forth... I'm attaching a small mock-up to be understandable on what i would like to achieve (it's based on the first 5 minutes of each hour). I've marked "Ok" the first row, meaning that since i've seen something similar, i'm confident in knowing what needs to be mastered to achieve that result. The "?" refers to what i haven't been able to understand if it's achievable or not (row 2, 3 and 4). Would it be advisable to build a Matrix for each of the 4 row (with N 8-bit microcontroller such as SN74HC595, for each row) , or can be achieved with a "simple" 4 X 60 matrix? Thanks a lot in advance to everyone "wasting" their time to give a helping hand! Seeya! Ivano

Topic by IvanoArduino    |  last reply


Help me make shiftOut faster (Arduino Function) Answered

I'm making a clock and I need an Attiny85 to output a "big" amount of data to a series of two shift registers. Using the shiftOut function that comes with the arduino lags the whole program down, making the clock annoying to the eye and reducing it's brightness.  I managed to reduce the lag a bit by substituting the digitalWrite functions from the whole program and creating a new function called shiftOutFast to replace the existing one, where I replaced two digitalWrite functions since I couldn't figure out much more.  void shiftOutFast(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder, byte val) {      for (i = 0; i < 8; i++)  {                                                 //could I change this to 16?            if (bitOrder == LSBFIRST)                  digitalWrite(dataPin, !!(val & (1 << i)));            else                       digitalWrite(dataPin, !!(val & (1 << (7 - i)))); //I guess here I should replace the 7 by a 15?                             PORTB |= _BV(PB0);                                         //there was a digitalWrite here            PORTB &= ~_BV(PB0);                                     //and also here (I believe this is called Port Manipulation)      } } This is the normal way I use the function, this whole operation is repeated 5 times, one for each digit position on the display and another one for the dots in the middle. As you can see I use it two times since shiftOut can only output 8 bits at a time. PORTB &= ~_BV(PB1); //latchPin low shiftOutFast(dataPin, clockPin, MSBFIRST, 8); //the values for the second shift register are sent first, this determines the digit that will be lit (1,2,3,4th position or the dots) shiftOutFast(dataPin, clockPin, MSBFIRST, numbers2[m]); //then pushed in place by the first one, this determines the number PORTB |= _BV(PB1); //LatchPin high //maybe I could reduce it to only one shiftOutFast (see 2nd question) I've reached the apex of what my programming skills can let me do, so I'll just simply ask two questions: Can I further optimize this function? I could remove the if since I won't be using the LSBFIRST If I changed the 8 by a 16 and the 7 by a 15 at the "for" inside the shiftOutFast function written above, could I reduce the use to only one function sending the 16 bits? Here's the whole program for the clock for further reference (this is actually a timer since attiny's aren't reliable when counting time) I would be extremely grateful if you found some way to optimize it or sent me a hint or two. http://pastebin.com/REcvbNhy Thank you!

Question by Victor805    |  last reply


What would you recommend for an Arduino starter kit? Answered

I have €60 =~ $79 / £50 to spend on an arduino and stuff to use with it as an introduction to electronics. I've looked around at other starter kits and so far, I plan to get: An arduino Deumillanove, A breadboard Jumper wire a few piezo elements, 5 x blue, 5x red, 5 x green LEDs, 2 x RGB LEDs. LOGIC, SHIFT REGISTER 8-BIT, 16DIP (how many of these will I need) So far that costs about €50 from ie.farnell.com. Are there any better places to buy from in Ireland? I have some motors with gear boxes and potentiometers that I used for school projects which I can recycle. I know that I'll need resistors but I don't know how many of which resistances. Is there anything else like sensors etc. that I might need or you think would be fun or good to learn with? I dont mind extending the budget if I have to. Thanks a lot in advance :D

Question by Technologic    |  last reply


want to display my text on a tft lcd

I have make a project, it receives a sms from the sending side (on sending side there is any mobile) on receiving side there is sony Ericsson t290 which receives the sms. mobile is connected to the serial cable (rs-232) and the sms through at commands is brought to the micro controller after passing through max 232 which converts rs232 logic to ttl logic for micro controller  after that my sms is display on the led dot matrix display which is controlled by shift register and Darlington pair. Now i want some help in it.. i want to display this sms on a tft lcd monitor or on a lcd tv.. now to display on a tft monitor i either need a vga access and some circuit which can display to that standard or can use fpga ( spartan 3) and to display on the lcd tv i either need to build a video stream of the lcd should use some thing else to display on it.. plz i need some help to solve this problem i need to display my sms recived on either of lcd of tft

Topic by sani  


LCD & PIC18F4520!

I am trying to write HELLO on an LCD. It is a 16x1 (called WH1601A). I am using C18 language with ICD3. My 8 data lines are connected to PORTD[0-7]. My 3 control lines are connected to PORTB[0-2]. I can see 8 shaded boxes on my LCD which occupies half of the screen, but when i run the program nothing happens and the 8 boxes just stay there and nothing is written. I have been going at this for 2 days to no avail. I'm guessing the mistake is from the code, please take a look! Help will be much appreciated. #include #pragma config WDT = OFF //DEFINING PORTS #define rs PORTBbits.RB0 #define rw PORTBbits.RB1 #define en PORTBbits.RB2 #define data PORTD //Function prototypes void init(void); void LCD_init(void); void LCD_data(unsigned char); void LCD_cmd(unsigned char); void LCD_busy(unsigned int); void LCD_sendstring(unsigned char *var); void main() { init(); LCD_init(); LCD_sendstring("Hello"); while(1); } void LCD_sendstring(unsigned char *var) {      while(*var)              //till string ends        LCD_data(*var++);  //send characters one by one } //Initialize the LCD void LCD_init() { LCD_cmd(0x01);     //Clear LCD     LCD_cmd(0x38);     //Function set: 2 Line, 8-bit, 5x7 dots   //LCD_cmd(0x0C); // 1 line, 8 bit, 5x7;           LCD_cmd(0x0F);     //Display on, Curson blinking command                  LCD_cmd(0x06);     //Entry mode, auto increment with no shift    } void LCD_data(unsigned char var) {      data = var;      //Function set: 2 Line, 8-bit, 5x7 dots      rs   = 1;        //Selected data register      rw   = 0;        //We are writing      en   = 1;        //Enable H->L   LCD_busy(1);      en   = 0;      LCD_busy(15);          //Wait for LCD to process the command } void LCD_cmd(unsigned char var) {      data = var;      //Function set: 2 Line, 8-bit, 5x7 dots      rs   = 0;        //Selected command register      rw   = 0;        //We are writing in instruction register      en   = 1;        //Enable H->L   LCD_busy(1);      en   = 0;      LCD_busy(15);          //Wait for LCD to process the command } void LCD_busy(unsigned int itime) {          unsigned char i,j;          for(i=0;i             for(j=0;j<255;j++); } void init() { OSCCONbits.IRCF2=1; //oscillator frequency = 8mhz OSCCONbits.IRCF1=1; OSCCONbits.IRCF0=1; ADCON1=0xFF; //make ports digital TRISD=0x00; //PORTD output TRISB=0x00; //PORTB output PORTD=0x00; PORTB=0x00; en = 0; LCD_busy(250); } Any idea guys?! This is the first time i work an LCD and I could not find a problem in the forums. 

Question by Chris414    |  last reply


(Arduino) automated macro-photography rail

Hi everyone, I would like to build an Arduino automated macro-photography rail (let's call it AAMR). I'm a decent software engineer and I want to learn electronics, so I'm looking for someone telling me I'm going in the right direction... The idea sounds simple, I want to : 1/ place the subject on the AAMR 2/ input the # of pictures needed to perform a "focus stacking" (https://en.wikipedia.org/?title=Focus_stacking) 3/ push the start button and make the AAMR loop n times through the following steps : - trigger the camera to take a picture of the subject - move the subject 1 millimetre toward the camera After a couple weeks reading and day-dreaming, here are my thoughts. I need : - to read more :) - a steeper motor and its driver (I own bipolar steppers and L298 / L293 IC) - to trigger the camera (Canon EOS 70d : remote cable is quite easy to make) - a potentiometer and 2* 7segment displays (input and display the # of pictures) - a start button - a reset button to make the rail come back at position Zero - two "end of course" buttons (not sure about the English terminology), just in case the motor wants to jump over the board - power (5v for the arduino and the logic, 12v for the motors) I. Arduino ---------- First things first, I plan to use an Arduino Uno during prototyping and replace it by a home made board in the final product. Uno has 14 Digital I/O Pins and 6 Analog Input Pins : - stepper => 6 Digital pins (3 ?? if using http://www.bristolwatch.com/L298N/L298N_arduino.htm) - 7segment led => 3 Digital pins if using shift registers (https://www.instructables.com/id/Different-methods-of-driving-7-Segment-LED-display/step5/null/) - start button => 1 Digital pin - reset button => 1 Digital pin - "end of course" buttons => 2 Digital pins - camera trigger => 1 Digital pin (to drive an opto isolator / solid state relay) - potentiometer => 1 Analog pin 14 Digital pins ! Uno should do the job, am I right ? (I know I could use Analog pins as Digital ones, but it seems I don't need it...) II. PSU ------- Next interrogation is about power supply : I don't want a battery powered device and my options are scarce : - ATX PSU supplies both 5 and 12v, but Arduino seems to like >5v, so ATX doesn't seem a good choice - home made PSU from an existing wall wart -> voltage divider to get ~7v and ~14v -> 7805/7812 voltage regulator (may need heatsinks and/or little fan) If I do the math : - Arduino : 50ma - Stepper motor : 700mA max - L298 : 70mA (quiescent current) - 2* 7Segment LED (multiplexed) : 2 * 80mA (estimated) - Shift registers IC (SN74HC595N) : 1ma (optional : Hex inverter 74LS04 : ?? mA) Total : around 980mA... Am I doing right ? I have tons of questions left (Hex inverter, filter capacitors, motor noise reduction, solid state relays...), but it's a good start :) Sorry for the long post, and thanks in advance for your answers ! D

Topic by djezzz    |  last reply


Let It Glow! Contest Winners

Instructables and Monkeylectric are happy to announce the winners of the Let It Glow! Contest. The competition for this one was pretty fierce. Some very creative and crafty people entered some amazing Instructables and will be providing inspiration to other makers for a long time to come. The efficient LED was the most common tool of illumination, but there were also glowing bulbs, EL wire, candles, and even algae. It was a good show put on by all.If you didn't win, we highly recommend you check out the prize, the m132s from Monkeylectric. The pictures of it are fantastic and it looks even better in person.OK, on with the winners! Third PrizeThe authors of these Instructables will each receive an LED Throwie kit and an Instructables Robot t-shirt. 1up Mario Candle Animate with light Audio Visual Art....FOTC Style Building your own ambient color lighting bars Goldie's Toxic Waste Barrels Grow Your Own Bioluminescent Algae How to make an Iron Man Arc Reactor Light Bar Ambient Lighting LED Disco Light in a Jar! The Lucid Dream Machine Model Rocket LED Glow Effects Razor Scooter Underglow Double Mod! Second Prize The authors of these Instructables will each receive one (1) m132 bike wheel light, and an Instructables Robot t-shirt £5 Japanese lamp from recycled materials Animating Multilayered Engravings FlashBack - Backpack, Camelbak or Jersey Integrated LED Bike Flashers LED matrix using shift registers First Prize The authors of these Instructables will each receive a set of two (2) m132s bike wheel lights and an Instructables Robot t-shirt. how to add EL wire to a coat or other garment turn signal biking jacket

Topic by fungus amungus    |  last reply


Esquire's e-Ink cover

A friend writes:If anyone is interested in hacking the E-Ink version of the October issue of Esquire, here's some info. First, it's not available everywhere, but just in major stores like Borders and Barnes & Nobel. I got one at the Emeryville Borders. They have a display rack full of them.After removing the paper, tape, printed plastic and foam padding, here's what's left: (see pic)The PCB has 6 (!) 3V lithium batteries. It looks like one poweres the control electronics and the other five give 15 volts to run the displays. There's a PIC12F629 and some pads for in-circuit programming. There's also a couple of 4094 8 bit shift registers. There are two E-Ink display panels, but they're not general-purpose dot matrix. They have a small number of pre-patterned regions that can be made black or white. If you disconnect a panel from the circuit, the panel remains in its last state.It might be possible to open up a panel and put a different pattern underneath it (say, with a PCB). Might be fun.The PCB could be useful even without the E-Ink displays. You could connect a bunch of LEDs to it and reprogram the PIC. Not bad for $5.99 plus tax.I did later tear open one of the two display panels. You can remove the aluminum backing to reveal the connections printed in cunductive paint on the back of a pattern in conductive plastic. Trying to peel the conductive plastic away from the E-Ink active layer destroys the display, and releasing a tiny amount of E-Ink dust.It does look like one could cut the display into small pieces to possibly make small separate indicators. You'd need to retain the edge that connects to the clear conductive plastic on the front of the display.

Topic by rachel    |  last reply


Arduino Multiplexing Code Issue

I'm trying to select a pattern for 12 multiplexed leds (2x6) using the input from a pot. The different patterns are stored in arrays. To complicate matters two of the states include a blinking led, the first, redShift attempts to blink a single led, 1, using a for loop to step through an array. The other holds on leds 2-11 and flashes 12 using the same method. The input from the pot is diveded into 12 sections and a switch case is supposed to select the proper arrays to read from. Here is the code: //LED TEST 2 w/ 74HC595 //by Bwrussell 2013 //https://www.instructables.com/id/ /* Program Flow/Intent: Hardware: a 2 rows by 6 columns LED matrix running through a 595 shift register, arranged in a single line, and a potentiometer. The pot's input is divided into 12 ranges. These ranges correspond to incrementing LED patterns. There are 3 different types of pattern, the first blinks only the first, red, LED, the second covers 9 ranges and each one turns on an additional led, keeping those behind it on, the final type has all but the first LED on and blinks the final one. */ /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ //pin connections- the #define tag will replace all instances of "latchPin" in your code with A1 (and so on) #define latchPin A1 #define clockPin A0 #define dataPin A2 #define potPin A5 // analog pin for reading the pot's input. //looping variables byte i; byte j; //LED state storage arrays byte firstStates[] = {2,6,14,30,62,62,62,62,62,62}; //first row, non flashing, states byte secondStates[] = {0,0,0,0,0,1,3,7,15,31}; //second row, non flashing, states byte redFlashO[] = {1,1,1,0,0,0}; //row 1 states for red flashing byte redFlashT[] = {0,0,0,0,0,0}; //row 2 states for red flashing byte greenFlashO[] = {62,62,62,62,62,62}; //row 1 states for green flashing byte greenFlashT[] = {63,63,63,31,31,31}; //row 2 states for green flashing //Function variables byte dataToSend; //used in standardShift function byte redSend; //used in redShift function byte greenSend; //used in greenShift function //Storage variable byte normalState; //holds the array position for non flashing states byte redFlashingState; byte greenFlashingState; int rowOne; //passes the non flashing state of the first row int rowTwo; //passes the non flashing state of the second row int position; //holds the output from the potRead function void setup() { //set pins as output pinMode(latchPin, OUTPUT); pinMode(clockPin, OUTPUT); pinMode(dataPin, OUTPUT); Serial.begin(9600); } void loop() { position = potRead(); //read the current knob position switch (position) { case 0: //blink red led redShift(); break; case 11: // blink green led code here greenShift(); break; default: normalState = position--; rowOne = firstStates[normalState]; rowTwo = secondStates[normalState]; standardShift (rowOne, rowTwo) ; } } void standardShift (int firstRow, int secondRow) { byte stdArray[] = {firstRow, secondRow} ; for (i=0;i<2;i++){ //send data from ledData to each row, one at a time byte stdData = (1 << (i+6)) | (63 & ~stdArray[i]); // setlatch pin low so the LEDs don't change while sending in bits digitalWrite(latchPin, LOW); // shift out the bits of dataToSend to the 74HC595 shiftOut(dataPin, clockPin, LSBFIRST, dataToSend); //set latch pin high- this sends data to outputs so the LEDs will light up digitalWrite(latchPin, HIGH); } } int potRead () { int potRaw = analogRead(potPin); int potPosition = potRaw / 93; //returns a value 0-11 return potPosition ; } void redShift() { for (i=0; i<6; i++) { byte redArray[] = {redFlashO[i], redFlashT[i]} ; for (j=0; j<2; j++) { byte redData = (1 << (j+6)) | (63 & ~redArray[j]); // setlatch pin low so the LEDs don't change while sending in bits digitalWrite(latchPin, LOW); // shift out the bits of dataToSend to the 74HC595 shiftOut(dataPin, clockPin, LSBFIRST, dataToSend); //set latch pin high- this sends data to outputs so the LEDs will light up digitalWrite(latchPin, HIGH); } } } void greenShift() { for (i=0; i<6; i++) { byte greenArray[] = {redFlashO[i], greenFlashT[i]} ; for (j=0; j<2; j++) { byte greenData = (1 << (j+6)) | (63 & ~greenArray[j]); // setlatch pin low so the LEDs don't change while sending in bits digitalWrite(latchPin, LOW); // shift out the bits of dataToSend to the 74HC595 shiftOut(dataPin, clockPin, LSBFIRST, dataToSend); //set latch pin high- this sends data to outputs so the LEDs will light up digitalWrite(latchPin, HIGH); } } } I'm having two issues. First, the switch case doesn't appear to be working. I've monitored the pot input but there is no response from the LEDs. The second is with the for loops that are suppose to run the blinking. I know the loop on the inside will hold a pattern but in test code, without the pot, but adding the outside loop to step through the pattern array breaks it and the LEDs don't respond. Is the for loop running to fast to respond but not fast enough for POV? do I need a third loop that repeats each position but wouldn't that break the POV for the other LEDs? Or is there some stupid error I'm missing?

Question by bwrussell    |  last reply


Circuitry help needed - microcontroller in binary clock

Ok, so I am currently working on a project which involves some circuitry and programming. I am planning to make a simple binary watch. Now with my current plan I am planning on making 2-3 circuit boards depending on what I can get. The first circuit board will connect the leds for the time read. It will be a standard four column hour and minute binary clock readout. The second board will contain an ATtiny85 microcontroller, a 74HC595 8-bit shift register, two push buttons, two 10k ohm resistors, and four 220 ohm resistor. The third board will be glued to the bottom of the second board for the battery holder and some extra space to add wire tracing. Now I plan to design and etch my own pcb boards and solder them together. Though for the second and third board being glued together would add a bit of thickness so I am wondering if I can buy a dual sided pre-sensitized circuit board to etch?Thes plans are based off the work of another user on here, link to his clock below: https://www.instructables.com/id/Simple-Binary-Cl... Credit to him for this great and simple system. With my very limited knowledge and understanding of circuitry and programming, this is one of the most straightforward clocks I have found. This is general format I will try to follow, though I do wish to make some modifications to the circuit or program based on what is possible with the circuit setup. First I am concerned about the power consumption of the system and how I can reduce the supplied power to make it run on a watch battery and run for about a year if possible or longer. Second I know that adding a crystal oscillator can improve the accuracy of the clock by synchronizing the internal clock on a set frequency. So with that, how would I add a 16 Mhz crystal oscillator to the circuit? The program that is given in the project runs based on the internal 16 Mhz internal clock of the ATtiny85. Third question is what system works best to program the ATtiny85? I have a Raspberry Pi 3B+ and I also have Syper IDE and I am fairly good at programming with python. So could I program the ATtiny85 with my Raspberry pi and use python? Or would I have to use a different board and language to program the micocontroller?

Topic by Tman179    |  last reply