A do-it-all-in-one-cable For laptops(an idea) Using the ATX 24...

I just recently got an idea,its kind of an ingenious(well i think so) idea.ITs a do-it-all-in-one cable,a cable that connects to your laptops s-video,rca,vga,sound,and even usb through one cable using CAT5 cable for it(If cat5 contains enough cables in it)The cable at both ends will have the ATX 24 pin connector that connects to a project box,but thats another part,we will get to that laterS-Video ---------- 3 Data 1 common groundRCA ---------------- 1 Data 1 common groundVGA ---------------- 5 Data 3 common groundUSB --------------- 2 Data 1 5V 1 common groundSound ------------ 2 Data 1 Common groundGrand total = 15-mixing grounds/ 19 - separate groundsSo according to that,i would need 2 and a half CAT5 Cables(if i use separate grounds),which i am going to squish together into one big cable.Or 2 CAT5 cables (if i mix all of the grounds)Now,i would have all of the cables squished together into some tubing(heat shrink?,no too expensive in such a large amount)with the ATX 24 pin connector at each end.Now,the project box,it will have the opposite connector(the one that the other connector connects to) will go into a box with that connector soldered on a breadboard inside of it(i could get the connector from a computer,or 2(i have 2 fried motherboards so ...))and in the other side of the (plastic)box would be all of the connectors(Sound connector,VGA,Svideo,RCA,usb(maybe for IR receiver or something))that connects to the TV,or monitor.The other end with the same connector would connect to the laptop,it would have VGA,RCA or SVideo,Sound,and USBSo now that i got my point out,what do you think?That the all-in-one cable,or a bunch of tangled cables just to put video and sound to the tv,and that is without USB,whats the fun of not having a usb connector from your laptop 20 feet away from you,you could connect a web cam,to see yourself on the tv,or a ir receiver,to control the pc without a keyboard and mouse,or whatever else you can think of.So...what do you think(poin tout any mistakes i have made by chance)So...comment...or whateveri think this would be pretty nifty,no?

Topic by ReCreate 10 years ago  |  last reply 10 years ago


Computer Power Supply?

Can i use a 20+4 pin power supply on a 24 pin motherboard? THANKZ!!!!

Question by sci4me 8 years ago  |  last reply 8 years ago


How to figure out schematic of 8x8 LED matrix? Answered

I don't have a datasheet for the bicolor LED matrix that I got on eBay. It has 24 (12x12) pins, but no way for me to tell which one is pin 1. Any clues? :)

Question by bratan 6 years ago  |  last reply 4 years ago


GBA sp ribbon pins: What does these do????????

I know the ribbon pins of the GBA sp AGS-101 backlit screen,(there are 34 pins total) and I want to hook up the pins to a vga cable to connect to the tv/monitor, (and I know how to connect the audio, that's not a problem) but the problem is, I don't know what these pins are, or do? Please help, there is a picture of a vga diagram.( I am trying to make a GBA sp Console) 1 - VSHD 2 - DCK 3 - LP 4 - PS 5 - VSHD 6 - GND 7 - LDR5 8 - LDR4 9 - LDR3 10 - LDR2 11 - LDR1 12 - LDG5 13 - LDG4 14 - LDG3 15 - LDG2 16 - LDG1 17 - GND 18 - LDB5 19 - LDB4 20 - LDB3 21 - LDB2 22 - LDB1 23 - SPL 24 - CLS 25 - SPS 26 - MOD 27 - REVC 28 - P2-VDD 29 - P2-VSS 30 - COM 31 - VDD5 32 - GND 33 - ??? (U83 on AGS-001) 34 - VDD5

Question by 8BITR 3 years ago  |  last reply 3 years ago


can you read the program from a Attiny24 to program other Attiny24?

I have a piece of equipment that has a pin 10 that is on all the time. is is shorted. I need to program a new Attiny 24.

Question by chargerhemi 1 year ago  |  last reply 1 year ago


Cable extension parts

I am working on a project involving a Presario V5000 laptop (well mainly its innards) and would love to find extension cables for some of the components.  For example, the keyboard attaches to the motherboard via a 24 pin flat ribbon-like cable (see example image).  It would be great if I could get a simple extension piece (male to female) to give me any additional length, but I cant seem to find anyone that makes this, or what the techincal name is for that type of cable. (is it even a cable?  Is it a flexible circuitboard?) Anyone aware of a good vendor for hard to find laptop accessories like this??

Topic by phdearthworm 9 years ago  |  last reply 6 years ago


what would this stepper controller pinout mean?

I salvaged the interesting bits from two gravity fed laserprinters recently, and was delighted to find the stepper motors have small driver boards mounted to them.  Unfortunately, i dont know much about steppers or their drivers.  I'm hoping somebody with more familiarity can point me in the right direction to figuring these out. They are 13.9W 24V steppers, and manually rotating them i can feel 24 jumps, so im guessing they rotate 24 steps per revolution. The pins on the driver are LD, CW, START, GND, DC24V.  Aare those common pins for a stepper driver?

Topic by Kyle_S 7 years ago  |  last reply 7 years ago


Will the wrong power supply kill a mobo and everything connected to it?

I got a 400watt power supply from from ebay to replace the 305watt PSU in my Dell Optiplex GX280..... I connected a new power supply incorrectly to the main motherboard connection. Plugged in the 20 pin into the right side of MB 24 pin connector (forced it in!), when I should have plugged it into the the left side, then add the additional 4 pin next to  the 20 pin. (the 400watt power supply is compatible with both 24 and 20 pin motherboard connections, of which I did not know at first). After I made this error, I turned on PC---and nothing works, other than yellow AUX light on mobo and fan works on graphics card. So, I re-installed the original PSU of 305 watts, and again---nothing works, no PSU fan, no CPU fan running. So the question is : Did I fry the mobo with everything else connected (RAM, HDD, CPU, etc.)...Or have I only killed the motherboard ITSELF?...I need to know whether to buy a new motherboard (Dell OH7276)...or just buy a new PC altogether. Dell Optiplex GX280 Tower, 3.4Ghz, 3GB RAM

Question by ddavel544 9 years ago  |  last reply 9 years ago


Need a 36 V schematic battery charger for a golf cart.

Is there an iintegrated circuit that you can tap in to a 120VAC  and convert to 36VDC @10-20 Amps without using a transformer> Have An Everest and Jennings 24 V @10 A model 11350 need output cable pin connections ? Bob

Question by henrys boards 6 years ago  |  last reply 6 years ago


Does solid state relay needs a protecting diode for the pin 3 out of a 555 monostable? Answered

Recently i need some timer for my capacitor charger to be used in a coilgun. i just finished a 555 one shot monostable pcb design.  my charger require about 24 watt of power which is unsufficient for the 555 pin 3 out,. I know that a protecting diode can be put with a relay. but a solid state for a solid state realay. does it need a diode. i just want to know because i will put it in my design 

Question by ARJOON 8 years ago  |  last reply 1 year ago


LCDs from electronic devices.

Dear fellow members. I have various LCDs from various devices (digital camera, mp3 players etc) that I wish to use. One has a 24 'pin' ribbon, another one is 20, and sure i have manny other ranges too. How can I get these bad boy's running? /experiment to find out which 'pin' does what? Is there any standards in regards to LCD displays? Unfortunatly, these displays don't have part numbers intact so i can't exactly look it up either. So basically i'm looking for a way to use an unknown LCD, or are they only fit for the bin? Thanks in advance, Luke.

Topic by lukus001 11 years ago  |  last reply 11 years ago


how do i drive a dual color led display with an arduino?

I bought a dual color RG 8x8 LED display from sparkfun, and how do i use it in an arduino project with MAX7221 controllers? it is a coomon cathode display with 24 pins. here is the item page: http://www.sparkfun.com/commerce/product_info.php?products_id=682and here is the datasheet: http://www.sparkfun.com/datasheets/Components/SanYoung-Medium-RG.pdfi am trying to make a simple 3 color clock (or something like that) with a dual color RG led matrix and an arduino.can someone tell me how to wire up the matrix to the arduino, because the arduino doesn't have enough pins to run 2 colors of 8x8'smore than 3 colors ( R , G , RG ) would also be nice with the arduino :)

Question by kroq-gar78 9 years ago  |  last reply 9 years ago


can anyone help build a basic computer?

The fact is pictures use 24 bits. It is not simple to use available microprocessors to make a computer at home. Way too many pins Well I think that a z80 microprocessor and two 8 bit presettable counters could deliver a picture with 24 bits. Did anyone really ask for microsoft? What task would you work on? Example number one 1)  computer division : this is binary number division with check in the loop  that you just drew up. The microprocessor only has about 125 commands that you write down.  A command can be as simple as jump to line 0000 0000 0000 0000 . this can be a simple loop that has to be done or the chip is scrapped.  The number 2)  Is there a picture chip like the commodore 64 has?  Find one. An easy chip.   3) Are there any monitors left?  Did any one ask for those  sounds microsoft has ? Most people should have figured out apple computers earlier.

Question by halamka 6 years ago  |  last reply 6 years ago


LED Cube problems

I am having some minor (or perhaps major) difficulties with my 3x3x3 Led Cube. I have a program that i wrote that cycles the different 3x3 cross sections and in 3 of the cross sections there is one column of leds that will light up even though it is not commanded or supplied power. I also have a sort of kill all routine that runs after each level is dislplayed that sets every pin to low. in my configuration the problem pins are pins 8, 17, and 26. if anyone knows how to debug this or help in any way it would be much appreciated. Thanks! I have a video of the LED cube with the problems here and a sample of my program here // kill all routine for(i=2, i<15, i++) { digitalWrite( i, LOW); } // Level routines that have problems of LEDs lighting up when they shouldn't elseif (LVL_Num ==10) {   for(j=0, j< Repeat, j++)   {    LED_ON(3); LED_ON(6); LED_ON(9);     delay(5)    LED_OFF(3); LED_OFF(6); LED_OFF(9);     delay(1)    LED_ON(11); LED_ON(14); LED_ON(17);    delay(5)    LED_OFF(11); LED_OFF(14); LED_OFF(17);    delay(1)    LED_ON(19); LED_ON(22); LED_ON(25);    delay(5)    LED_OFF(19); LED_OFF(22); LED_OFF(25);   } } elseif (LVL_Num ==11) {   for(j=0, j< Repeat, j++)   {    LED_ON(1); LED_ON(4); LED_ON(7);     delay(5)    LED_OFF(1); LED_OFF(4); LED_OFF(7);     delay(1)    LED_ON(11); LED_ON(14); LED_ON(17);    delay(5)    LED_OFF(11); LED_OFF(14); LED_OFF(17);    delay(1)    LED_ON(21); LED_ON(24); LED_ON(27);    delay(5)    LED_OFF(21); LED_OFF(24); LED_OFF(27);   } } elseif (LVL_Num ==13) {   for(j=0, j< Repeat, j++)   {    LED_ON(1); LED_ON(2); LED_ON(3);     delay(5)    LED_OFF(1); LED_OFF(2); LED_OFF(3);     delay(1)    LED_ON(13); LED_ON(14); LED_ON(15);    delay(5)    LED_OFF(13); LED_OFF(14); LED_OFF(15);    delay(1)    LED_ON(25); LED_ON(26); LED_ON(27);    delay(5)    LED_OFF(25); LED_OFF(26); LED_OFF(27);   } }

Question by Lee_Smith 6 years ago


Vertically Adjustable TV Wall Mount

I am in need of a vertically adjustable wall mount that would hold a 32" LCD TV and raise/lower the tv with 12-24" of travel. I live in an apartment and am on a tight tight tight budget, so I am trying to dual purpose a TV to be both computer monitor and bedroom television. My problem is that when the TV is sitting on the desk, I have to look between my feet to see it from the bed. It just isn't comfortable viewing. If I were to mount it at proper viewing height from the bed, I would be craning my neck to see it. I have scoured the internet and the only mounts they make like this are as expensive as another TV.  I am a novice at this kind of thing, so the simpler and cheaper the better. If I could mount some sort of track to the wall and use a heavy pin to set the height or something like that, that would be an idea. Any help would be much appreciated! Thank you,  Sean

Topic by SlyBlackDragon 4 years ago  |  last reply 4 years ago


Help With Arduino Robot Arm Record & Playback With SD Card, Bluetooth

Hi, I need some help please with the following code - lots of errors occur when I try to verify it. The author is unavailable for help & the code appears to be in the public domain. Check out the clip, it looks awesome! https://www.youtube.com/watch?time_continue=1&v;=7A1WL60wMe0 https://github.com/Dileepmeom/Arduino-Robotic-Arm- //# Arduino-Robotic-Arm---Copt-Cat //This project controls the Cartesian robotic arm using Arduino, Motion sequence can be recorded and played back just like //Industrial robot does /* COPY CAT Servo controlled Robot 5-axis Cartesian robot This software logs the angular movement of joints by reading the servo angles and stores it in the SD card, reproduces the movement by the reading back from the SD card. The circuit: analog sensors on analog ins 0, 1, and 2 SD card attached to SPI bus as follows: ** MOSI - pin 11 ** MISO - pin 12 ** CLK - pin 13 ** CS - pin 4 created 24 Nov 2010 modified 9 Apr 2012 by Tom Igoe This example code is in the public domain. */ include include define TRUE 1 define FALSE 0 // On the Ethernet Shield, CS is pin 4. Note that even if it's not // used as the CS pin, the hardware CS pin (10 on most Arduino boards // 53 on the Mega) must be left as an output or the SD library // functions will not work. const int chipSelect = 4; // constants won't change. They're used here to // set pin numbers: const int buttonPin = 2; // the number of the pushbutton pin const int servo3 = 5, servo4 = 6,servo5 = 5; // PWM for servo 3 // variables will change: int buttonState = 0; // variable for reading the pushbutton status int recievedchar = 0,dataON=0; int SDdata = 0; Servo myservo1; // create servo object to control a servo Servo myservo2; // create servo object to control a servo Servo myservo3; // create servo object to control a servo Servo myservo4; // create servo object to control a servo Servo myservo5; // create servo object to control a servo int servo1angle = 0,servo2angle = 0; unsigned long current_servo_micros, prev_servo_micros; unsigned long currentMillis,previousMillis = 0; int scheduler = 0; int servointerval = 20; int S3_microlocal; char servoON=0; void setup() { // Open serial communications and wait for port to open: Serial.begin(9600); while (!Serial) { ; // wait for serial port to connect. Needed for Leonardo only } pinMode(buttonPin, INPUT_PULLUP); Serial.print("Initializing SD card..."); // make sure that the default chip select pin is set to // output, even if you don't use it: pinMode(10, OUTPUT); // see if the card is present and can be initialized: if (!SD.begin(chipSelect)) { Serial.println("Card failed, or not present"); // don't do anything more: return; } Serial.println("card initialized."); } void loop() { long servo3ticks = 1000, servo4ticks = 1000, servo5ticks = 1000; // interval for servo cyle time / / read the state of the pushbutton value: buttonState = digitalRead(buttonPin); recievedchar = Serial.read(); // make a string for assembling the data to log: String dataString = ""; String arraystring = ""; String SDstring = ""; char firstseperator=0; unsigned long sensorarray[10]; int servoangle[5]; char arrayindex = 0; // open the file. note that only one file can be open at a time, // so you have to close this one before opening another. if(dataON == TRUE) { // read three sensors and append to the string: for (int analogPin = 0; analogPin < 5; analogPin++) { int sensor = analogRead(analogPin); sensorarray[analogPin] = sensor; dataString += String(sensor); if (analogPin < 4) { dataString += ","; } } File dataFile1 = SD.open("datalog.txt", FILE_WRITE); // if the file is available, write to it: if (dataFile1) { if(buttonState == HIGH) { // print to the serial port too: // Serial.println(dataString); /////////////////////////// debug code ///////////////////// for (arrayindex= 0; arrayindex < 5; arrayindex++) { int arrayvalue = sensorarray[arrayindex]; //arraystring += String(arrayvalue); } servo1angle = map(sensorarray[0], 102, 433, 0, 170); arraystring += servo1angle; arraystring += ","; servo2angle = map(sensorarray[1], 84, 468, 0, 180); arraystring += servo2angle; arraystring += ","; servo3ticks = map(sensorarray[2], 90, 393, 0, 150); arraystring += servo3ticks; arraystring += ","; servo4ticks = map(sensorarray[3], 107, 445,0, 180); arraystring += servo4ticks; arraystring += ","; servo5ticks = map(sensorarray[4], 151, 406, 10, 140); arraystring += servo5ticks; arraystring += ","; // Serial.println(arraystring); //// WRITE TO SD CARD // dataFile1.println(arraystring); dataFile1.close(); ///////////////////////////////////////////////////////////////// delay(10); } else { dataFile1.close(); // print to the serial port too: Serial.println("No signal for writing"); } } // if the file isn't open, pop up an error: else { Serial.println("error opening datalog.txt"); } } // the reading's most significant digit is at position 15 in the reportString: ////// switch case starts ///////////////////////// switch (recievedchar) { case 'D': { dataON = TRUE; Serial.print("Recording"); Serial.print("\n"); myservo1.detach(); myservo2.detach(); myservo3.detach(); myservo4.detach(); myservo5.detach(); break; } case 'S': { dataON = FALSE; Serial.print("Stopped"); Serial.print("\n"); break; } case 'R': { myservo1.attach(5); // attaches the servo on pin 9 to the servo object myservo2.attach(3); // attaches the servo on pin 9 to the servo object myservo3.attach(8); // attaches the servo on pin 9 to the servo object myservo4.attach(7); // attaches the servo on pin 9 to the servo object myservo5.attach(9); // attaches the servo on pin 9 to the servo object File dataFile1 = SD.open("datalog.txt"); Serial.print("Playing Back Motions"); Serial.print("\n"); // if the file is available, write to it: if (dataFile1) { while (dataFile1.available()) { SDdata = dataFile1.read(); SDstring += (char)SDdata; // if(isDigit(SDdata)) // { // SDstring += (char)SDdata; // } // else // { // // int Sensordata = (inString.toInt()); // SDstring += ("_"); // } if(SDdata == '\n') { digitalWrite(servo4, LOW); String reportString = SDstring; // Serial.print("\n"); // Serial.println(reportString); // Serial.print("\n"); int seperator[5]={0}; int n=0,startfrom=0; for(n=1;n<=5;n++) { seperator[n]= reportString.indexOf(',',startfrom); startfrom = seperator[n]+1; // Serial.print(seperator[n]); // Serial.print("\n"); } seperator[0]=-1; for(int count=0;count<=4;count++) { String sens1data = ""; for(int index = (seperator[count]+1); index < seperator[count+1]; index++) { char mostSignificantDigit =SDstring.charAt(index); sens1data += String(mostSignificantDigit); // Serial.print(index); // Serial.print(","); } servoangle[count+1] = sens1data.toInt(); // Serial.print(servoangle[count+1]); // Serial.print(sens1data); // Serial.print("\n"); } delay(15); SDstring = ""; } // myservo1.write(0); // myservo2.write(100); // myservo3.write(100); // myservo4.write(100); // myservo5.write(10); myservo1.write(servoangle[1]); myservo2.write(servoangle[2]); myservo3.write(servoangle[3]); myservo4.write(servoangle[4]); myservo5.write(servoangle[5]); } dataFile1.close(); myservo1.detach(); myservo2.detach(); myservo3.detach(); myservo4.detach(); myservo5.detach(); } // if the file isn't open, pop up an error: else { Serial.println("error opening datalog.txt"); } break; } case 'E': { if(SD.exists("datalog.txt")) { Serial.print("datalog.txt file found, preparing to delete"); SD.remove("datalog.txt"); Serial.print("\n"); Serial.print("file deleted..."); } break; } } }

Topic by steve444 3 years ago  |  last reply 2 months ago


Built ATX PSU to Multi-Volt power supply. Voltage drops when applying load, what may be wrong?

I converted my 500w PSU following instructions in here. The PSU boasts 480w real power on with 20amps on the 12v rail. I thought I had done everything correctly, and the Power supply gives correct voltage on all binding posts when there is no load, but when I connect a simple 5w lightbulb to the 12v the fan spins down and the light is not as bright as I would expect. Also when measuring the output voltage it now is down to 8,30 volts. Measuring the amp shows 0,33A. When trying out a 21w lightbulb the problem gets more visible, as the light flickers and there is a ticking sound from the PSU. The voltage now travels between 8,10 and 8,16 volts, the amp showing 1,31 amps. I tried grounding directly to the PSU chassis, I cut the wires to the 5v USB ports (these did not work anyway, perhaps because I have no sandbar resistor?) and also tried to give power from the wires only related to the 24 PIN molex connector or only from the 4 pin connectors, all with the same symptoms. Anyone have any clue as to what may cause this anomaly? My plan was to use the power supply as a substitute for a battery to run power in my caravan, converting straight from the 220v. There are only a set of lights and a small water pump running on the circuit, adding up to approximately 200 watts if everything is turned  on. I figured the PSU would be sufficient to do this, but maybe I am mistaken?

Question by StigW 3 years ago  |  last reply 3 years ago


Arduino Coding help? Answered

I need some guidance on how to write some Arduino code. The physical side is an Arduino mega ADK connected to some buttons and leds. On the code side, I modified the button sketch. I am stuck on how to add multiple buttons. in the void loop. I just need someont to show me how to add 1 after that i can figure out how to add the rest. Thanks,  Kaden const int button1 = 24;     // the number of the pushbutton pin const int button2 = 25; const int button3 = 26; const int button4 = 27; const int button5 = 28; const int Bucket1 = 2; const int Bucket2 = 3; const int Bucket3 = 4; const int Bucket4 = 5; const int Bucket5 = 6; const int Bucket6 = 7; const int Bucket7 = 8; const int Bucket8 = 9; const int Bucket9 = 10; const int Bucket10 = 11; const int Bucket11 = 12; const int Bucket12 = 13; int buttonState1 = 0;         // variable for reading the pushbutton status int buttonState2 = 0; int buttonState3 = 0; int buttonState4 = 0; int buttonState5 = 0; void setup() {   // initialize the LED pin as an output:   pinMode(Bucket1, OUTPUT);   // declare LED strip pin as output   pinMode(Bucket2, OUTPUT);   pinMode(Bucket3, OUTPUT);   pinMode(Bucket4, OUTPUT);   pinMode(Bucket5, OUTPUT);   pinMode(Bucket6, OUTPUT);   pinMode(Bucket7, OUTPUT);   pinMode(Bucket8, OUTPUT);   pinMode(Bucket9, OUTPUT);   pinMode(Bucket10, OUTPUT);   pinMode(Bucket11, OUTPUT);   pinMode(Bucket12, OUTPUT);   // initialize the pushbutton pin as an input:   pinMode(button1, INPUT);   pinMode(button2, INPUT);   pinMode(button3, INPUT);   pinMode(button4, INPUT);   pinMode(button5, INPUT); } void loop() {     buttonState1 = digitalRead(button1);   buttonState2 = digitalRead(button2);   buttonState3 = digitalRead(button3);   buttonState4 = digitalRead(button4);   buttonState5 = digitalRead(button5);   // check if the pushbutton is pressed.   // if it is, the buttonState is HIGH:   if (buttonState1 == HIGH) {     // turn LED on:   digitalWrite(Bucket1, HIGH);  // turn LED strip on when button is pressed   digitalWrite(Bucket2, HIGH);   digitalWrite(Bucket3, HIGH);   digitalWrite(Bucket4, HIGH);   digitalWrite(Bucket5, HIGH);   digitalWrite(Bucket6, HIGH);   digitalWrite(Bucket7, HIGH);   digitalWrite(Bucket8, HIGH);   digitalWrite(Bucket9, HIGH);   digitalWrite(Bucket10, HIGH);   digitalWrite(Bucket11, HIGH);   digitalWrite(Bucket12, HIGH);   }   else {     // turn LED off:   digitalWrite(Bucket1, LOW);  // turn LED strip on when button is pressed   digitalWrite(Bucket2, LOW);   digitalWrite(Bucket3, LOW);   digitalWrite(Bucket4, LOW);   digitalWrite(Bucket5, LOW);   digitalWrite(Bucket6, LOW);   digitalWrite(Bucket7, LOW);   digitalWrite(Bucket8, LOW);   digitalWrite(Bucket9, LOW);   digitalWrite(Bucket10, LOW);   digitalWrite(Bucket11, LOW);   digitalWrite(Bucket12, LOW);   } }

Question by FarmerKJS 3 years ago  |  last reply 3 years ago


Standby mode for an ASK RF transmitter and HT12E combination? Answered

Hey,     I am working on a project that uses the HT12E encoder to encode binary codes and an ASK RF transmitter that transmits the data at 433 MHz.It will be received by their respective counterparts i.e,HT12D and ASK RF receiver.The range is about 25 metres.The transmitter is at the roof of my house while the receiver is on the ground floor(The circuit is for detecting the water level in a tank). The transmitter is not required to transmit 24/7 but only when the receiver is switched ON.It can be achieved by making the transmission enabling pin of the encoder ic high when transmission is not needed but for that I would either have to go to the roof and turn the transmitter ON(which beats the purpose) or I'll need another transmitter-receiver pair which would occupy positions opposite to the pair that already exists.(It would essentially be a transceiver then). But I don't want another pair of transmitter-receiver and neither do I want the transmitter to transmit continuously . What I need is a solution to install a standby mode for the transmitter and are there any ways to do that keeping in mind the above requirements? Any help will be appreciated and thank you for reading my question.

Question by Adarsh_tronix 4 years ago  |  last reply 4 years ago


Help with a game system mod?

I'm buying a sega game gear to mod. I want to add an a/v input without using the tv tuner accessory. Is this possible? I cant find it anywhere online, but i did find a pinout and it seems possible. I know i could connect the audio to pins 44 and 45. Would it work if i connected the video in to pin 43? Any help would be appreciated. Thanks in advance. 1 +34(V) liquid drive                                        24 MREQ memory request 2 +5(V) +5(V)                                                    25 A10/TPR2 address 3 /WR write signal                                           26 /RD read signal 4 A12 address                                                 27 /EXM 2 0~7FFFH 5 A7/CL1B3 address                                      28 A15 address 6 A6/CL1A2 address                                      29 A11 address 7 A5/CL1B2 address                                      30 A9/TPR1 address 8 A4/CL1A1 address                                      31 A8/CLIA3 address 9 A3/CL1B1 address                                      32 A13 address 10 A2/DW address                                          33 A14 address 11 A1/DO3 address                                        34 /EXM1 8000~BFFFH 12 A0/DO1 address                                        35 +5v +5 volts 13 D0/DB data                                                 36 /M1 M1 cycle 14 D1/P3 data                                                  37 IORQ I/O request 15 D2/P2 data                                                  38 /RFSH refresh 16 GND D ground                                           39 /RESET Reset 17 GND A ground                                            40 CCLK Clock 18 GND D ground                                           41 GND Ground 19 D3/P4 data                                                  42 /GG MS/GG 20 D4/P1 data                                                  43 /TV TV Cart 21 D5/CL2 data                                               44 TVSNDR VR Right Audio 22 D6/DO2 data                                              45 TVSNDL TV Left Audio 23 D7/DO4 data

Question by musick_08 7 years ago  |  last reply 7 years ago


Old hobbies die hard... some TRs

I had a lot of old pics to work off of so the building experience was a lot like what I remember loving about knex, without the frustration. This blaster (:>) has a pretty solid mech. The slide, anchored by the gray connectors on the naked black rods (hehe), requires the full motion to prime, resulting in the longest pin draw possible using this draw/anchor method. The pin I have on this has a rubber washer of sorts that I had laying around, so far working wonders. No broken pieces were required, though I slid a broken black rod that was conveniently the perfect length into the barrel construction. As I mentioned in the title, I built this just yesterday and I expect that it'll be further modified -- the grip was something I had lying around and could essentially just throw on, the stock was rushed. I was planning on building another and I'd be happy to make instructions if there's any demand, though these pics alone may be enough for the few of you. (8/24/15) Link to better quality pictures, really unimpressed by what got uploaded here... https://imgur.com/a/4y1Se Credit to KILLERK for the TR of course. I just gave it a new body. Update 8/25/15: 3D printed a piece for the front of the barrel. Update 8/27/15: Small changes all over. I'm okay with the front grip. There's some mole skin on the handle. Changed the below pictures to reflect what I currently have, clearer pics in the imgur album. Update 8/31/15 Finally got around to classing up the stock, quite happy with how it turned out. A few other changes as well, updated the pictures once more. Should be able to build from these pics!

Topic by Knarez 3 years ago  |  last reply 3 years ago


Inventor Builds His Perfect Woman

From The Sun, 11 Dec 2008:SHE is the perfect wife, with the body of a Page 3 pin-up and housekeeping skills that put TV's Kim and Aggie to shame.Her name is Aiko, she can even read a map, and will never, ever, nag. Sounds too good to be true, doesn't she fellas? And she is.Aiko is actually a robot, a fantasy brought to life by inventor Le Trung. Devoted Aiko --- "in her 20s" --- has a stunning 32-23-33 figure, pretty face and shiny hair.She is always happy to clean the house for "husband" Le, help with his accounts or get him a drink.Computer ace Le, 33, from Ontario, Canada, has spent two years and £14,000 building his dream girl.He had planned to make an android to care for the elderly.But his project "inspired by sci-fi robots like Star Wars's C3PO " strayed off-course. [ ... ]He said: "Aiko doesn't need holidays, food or rest, and will work almost 24 hours a day. She is the perfect woman."Aiko sparks mixed reactions in public.Le said: "Women usually try to talk to her. But men always want to touch her, and if they do it the wrong way she slaps them."Read the whole article, with a video clip and pictures, at http://www.thesun.co.uk/sol/homepage/news/article2023392.ece

Topic by kelseymh 10 years ago  |  last reply 9 years ago


What would be the VERY BEST way for me to TRANSITION into my newly adopted off-grid, survivalist, subsistence lifestyle? Answered

A 16'x16'x16', 256-square foot, A-frame cabin on an elevated 3' concrete paver floating DekBlock foundation with a 3'x 6'8" front flush door, one rear 48"x 48"horizontal slider window, and another upper 24"x 24" horizontal slider window for the sleeping loft.I'm thinking that one of those standard U.S. Stove designs might provide just a little too much heat for my needs up in the Copper River Basin region of ALASKA's rural backcountry. Who knows? What are your suggestions for the above described "habitat"? Where can I find the best deals for my 256-square foot space? (Heating/ventilation-wise, we're speaking of subzero temperatures and heavy snowfall, so, I don't believe that "opening a window" is a practical solution for me if it gets too hot and smokey inside my A-frame.) Plus, I've done the HEATING ESTIMATE for the A-frame I'm going to build and the numbers come out to about a 620,000 btuh (heat loss) for the new dimensions I'm finally settling on: 16'x16'x16' or 256sq.ft. This calculation is for -50 degrees F with cold floor, ceiling, and glass surfaces taken into account. (Insulation isn't a factor this early in the design.) "Wow!" I thought at first. "A 620,000 btuh HEAT LOSS! I reckon you can never have too much stove even for an A-frame design." (Being that A-frame cabins retain heat so well, and that my sleeping loft may get really HOT in the Winter, this was a preliminary concern.) Foundation:(4) 8"- diameter cardboard cylindrical concrete forms for pin-point piers;(4) 84" reinforcement rods for pin-point concrete forms;(16) Bricks for base of footing;(24) Layout stakes;(8) 5' batter boards;(1) Spool of wire for joining the two 14" reinforcement rods for each footing base;(1) Spool of line for marking building layout lines;(?) Bags of cement;(?) Bags of gravel;(?) Bags of sand...*A few questions about the amount of concrete needed for the four footings and the four concrete piers: "How much concrete will be needed for four 8"-deep concrete footings poured into four 16"-diameter, 44"-deep holes with each containing four bricks and the four reinforcement rod supports? How much concrete will be needed to fill four 8"-diameter pin-point concrete pier forms to an estimated height of about 80"-inches? How many total bags of cement, gravel and sand (aggregate) will my foundation require? Most importantly, how much will it all cost?"A-Frame Structural Triangle (Theoretical Dimensions):Sides = 16'Base = 16'Angles opposite sides = 60 degreesAngle opposite base = 60 degreesArea = 110.85125168441 sq. ft.Perimeter = 48 ft.Framing:(2) 2"x 10"x 16' girders;(12) 2"x 6"x 12' rafters;(6) 2"x 6"x 8' joists;(4) 2"x 4"x 4' collar beams;(10) 4'x 4' plywood sheets for subflooring;(2) 16' framing braces for structural support against wind damage;(?) 3200-square feet of roof/wall sheathing material for exterior surface areas...*A few questions about the amount of roof/wall sheathing material needed to cover the 3200-square foot exterior surface area: "How much exterior sheathing will I need? How much will it cost? I understand that metal sheathing is preferred in the Copper River Basin region for its snow-shedding ability, so, given everything I've just said, what are my options for the A-frame I recently designed?"My total approach to this whole subsistence lifestyle (i.e. living off the land within a small, confined space) is probably all wrong. I understand that I might need to change my complete "mindset" and adopt a sort of NAUTICAL (or MARITIME) theme with my decor, furnishings and appliances.Since I'm really getting into boats anyway (my one chosen option for escaping the bitterly harsh winters of ALASKA's COPPER RIVER BASIN if all else fails), I feel that marine stoves, composting toilets, and an overall nautical aspect in the "finish work" might help me cope since sailboat cabins tend to be tiny, and I may need to transplant a lot of what I have to my seagoing vessel, "Vera Essie".www.geocities.com/wduncanbinns

Question by Herr VOLKMAR 10 years ago  |  last reply 10 years ago


Help for realising a linefollower tankbot

Hello, I want to realize a linefollowing tank bot. I got this following parts: - Arduino Mega 2560 - Arduino MotorShield Rev03 - Pololu QTR-8RC Array - Pololu RP5 Tankchassis (6V DC Motors) Now all parts are together and the code must be completed. Therefore I found a really nice PID-based tutorial for linefollower: http://letsmakerobots.com/blog/enigmerald/pid-tutorials-line-following I create a program, but after calibrating the sensors, the bot doesn't drive on the line. It makes no sense were it drives. Most time it do 90° turns and so on. Do you find a better solution for my code? [code] #include #include   /////////////////////////// // define constants   // /////////////////////////// #define AUTO_CALIB  false      // Autokalibrierung aktivieren #define DEBUG_ENABLE   true               // false=keine Serial Ausgaben #define NUM_SENSORS    8                  // Anzahl der verwendeten Sensoren #define TIMEOUT        2500               // waits for 2500 microseconds for sensor outputs to go low #define EMITTER_PIN    QTR_NO_EMITTER_PIN         // Default: kein Emitterpin definiert #define MOTOR_SPEED    100               // PWM Signal 0-255 (Basismotorgeschwindigkeit) #define MOTOR_MAX_SPEED 255       // PWM Signal für Maximalgeschwindigkeit #define KP     0.2                    // KP-Wert für PID Regler #define KD     5                     // KD-Wert für PID Regler ( Beachte: Kp < Kd) #define SERVO_PIN1  11       // PWM Ausgang für Servo1 #define SERVO_PIN2  12       // PWM Ausgang für Servo2 #define CALIB_LED   13       // LED Ausgang für Kalibrierungsphase ////////////////////////// // define variables     // ////////////////////////// // Zuweisung der Sensoren 0-7 an die digitalen IO's 22-29 QTRSensorsRC qtrrc((unsigned char[]) {22, 23, 24, 25, 26, 27, 28, 29}, NUM_SENSORS, TIMEOUT, EMITTER_PIN); unsigned int sensorValues[NUM_SENSORS]; int MotorLeftSpeed=3;                  // PWM pin for speed control left int MotorRightSpeed=11;                // PWM pin for speed control right int MotorLeftDirection=12;            // digital pin for direction control left int MotorRightDirection=13;            // digital pin for direction control right int MotorLeftBrake=9;                  // digital pin for brake control left int MotorRightBrake=8;                 // digital pin for brake control right int lastError = 0; ///////////////////// // Initialisierung // ///////////////////// void setup() {     // Initialisierung verschiedner IOs   pinMode(CALIB_LED, OUTPUT);    // Definiert LED Ausgang für Kalibierungsphase       // Initialisierung linker Motor   pinMode(MotorLeftDirection, OUTPUT);      // Definiert Ausgang für den linken Motor   pinMode(MotorLeftBrake, OUTPUT);          // Definiert Bremse für den linken Motor   pinMode(MotorLeftSpeed, OUTPUT);   // Definiert Geschwindigkeitsausgang für linken Motor   // Initialisierung rechter Motor   pinMode(MotorRightDirection, OUTPUT);     // Definiert Ausgang für den rechten Motor   pinMode(MotorRightBrake, OUTPUT);         // Definiert Bremse für den rechten Motor     // Initialisierung Servo Motoren   servo1.attach(SERVO_PIN1);     // Zuweisung PWM PIN für Servo1   servo2.attach(SERVO_PIN2);     // Zuweisung PWM PIN für Servo2   if (DEBUG_ENABLE)   {    Serial.begin(9600);    Serial.print("Debug Modus aktiviert:\n");     }     delay(500);     digitalWrite(CALIB_LED, HIGH);    // turn on Arduino's LED to indicate we are in calibration mode   for (int i = 0; i < 400; i++)   // make the calibration take about 10 seconds   {     qtrrc.calibrate();           // reads all sensors 10 times at 2500 us per read (i.e. ~25 ms per call)   } delay(20);      // The 20 ms delay in the calibration code is intended to make the routine take a reasonable amount of time.     digitalWrite(CALIB_LED, LOW);     // turn off Arduino's LED to indicate we are through with calibration       if (DEBUG_ENABLE)    {    // print the calibration minimum values measured when emitters were on       for (int i = 0; i < NUM_SENSORS; i++)    {   Serial.print(qtrrc.calibratedMinimumOn[i]);   Serial.print(' ');    }    Serial.println();       // print the calibration maximum values measured when emitters were on    for (int i = 0; i < NUM_SENSORS; i++)    {   Serial.print(qtrrc.calibratedMaximumOn[i]);   Serial.print(' ');    }    Serial.println();    Serial.println();   }   delay(1000);   } /////////////////// // Main Program  // /////////////////// void loop() {   // read calibrated sensor values and obtain a measure of the line position from 0 to 5000 // To get raw sensor values, call: // qtrrc.read(sensorValues); instead of unsigned int position = qtrrc.readLine(sensorValues); // Variable positon zeigt die genaue Position (0-7000) an   unsigned int position = qtrrc.readLine(sensorValues); // get calibrated readings along with the line position, refer to the QTR Sensors Arduino Library for more details on line position. int error = position - 3500;  // 3500 is the desired position   if (DEBUG_ENABLE)   {    // print the sensor values as numbers from 0 to 1000, where 0 means maximum reflectance and    // 1000 means minimum reflectance, followed by the line position    for (unsigned char i = 0; i < NUM_SENSORS; i++)    {     Serial.print(sensorValues[i]);     Serial.print('\t');    }    Serial.print(position);    // comment this line out if you are using raw values   } int motorSpeed = KP * error + KD * (error - lastError); lastError = error; int rightMotorSpeed = MOTOR_SPEED + motorSpeed; int leftMotorSpeed  = MOTOR_SPEED - motorSpeed;     if (rightMotorSpeed > MOTOR_MAX_SPEED ) rightMotorSpeed = MOTOR_MAX_SPEED;    // Verhindert dass die Maximalgeschwindigkeit überschritten wird if (leftMotorSpeed > MOTOR_MAX_SPEED ) leftMotorSpeed  = MOTOR_MAX_SPEED;    // Verhindert dass die Maximalgeschwindigkeit überschritten wird if (rightMotorSpeed < 0) rightMotorSpeed  = 0;          // Verhindert einen negativen Geschwindigkeitswert if (leftMotorSpeed < 0) leftMotorSpeed   = 0;          // Verhindert einen negativen Geschwindigkeitswert   {   // Ansteuerung der Motoren durch PID Berechnung   digitalWrite(MotorRightBrake, LOW);     // Motorbremse rechts deaktivieren   digitalWrite(MotorLeftBrake, LOW);     // Motorbremse links deaktivieren   digitalWrite(MotorRightDirection, HIGH);   // Motor rechts im Uhrzeigersinn  --> fährt vorwärts   digitalWrite(MotorLeftDirection, LOW);    // Motor links gegen den Uhrzeigersinn  --> fährt vorwärts   analogWrite(MotorRightSpeed, rightMotorSpeed);  // Motorgeschwindigkeit rechts in Abhängigkeit des PID Reglers   analogWrite(MotorLeftSpeed, leftMotorSpeed);  // Motorgeschwindigkeit links in Abhängigkeit des PID Reglers }           } [/code]

Topic by julianpe 3 years ago  |  last reply 3 years ago


Arduino LED Clock RGB?

This is probably too big of a project for a first timer.I do not own a Arduino but plan to get one in the next few weeks or so or whenever Make releases the Getting started with Arduino KIT Again. I'm planing my project so that I can work on it with the fewest problems. I had the idea from 5volts fire extinguisher striking clock. My question is that is there a way that I can use RGB LEDs? I just wanted to use RGB LEDs instead of 7 segment displays but use the same layout and have a nice color fade with the time.http://www.5volt.eu/archives/16 Look for his schematic and code.The schematic shows a easy way to hook up a 7 segment display to an Arduino. I'm just not sure how to control another color. I was thinking maybe 3 BU2090's going from pins 12 an 13 and using the Arduino to control the power going to them. 5volt suggested triple multiplexing but I'm not too sure on how to do that. Also I'm not sure on common anode or common cathode LEDs?(I don't want to use 54 of each color.)As for clock face I was thinking like in the picture. 2 LEDs per segment, 8 for the colon. That is a 24"x12" box using 10mm LEDs. Center to center LED height is 7.125"Any help would be appreciated I have hit a snag trying to figure this out.

Topic by Rob K 10 years ago


Why is my RGB led strip giving lots of problems?

Hi,      I'm working on project with RGB LED strips with my arduino and a ATtiny84. Basically, what I plan to do is attach the strip to my display cabinet and attach the strip to an ATtiny84 microcontroller which will program the lights. Doing this I have encounter a few problems. As I haven't receive my ATtiny84 chip from the store yet, I'm testing everything on my arduino first. I first attached a normal single RGB LED to test all my programs and it works almost fine.       My first problem was when I attached 3 potentiometer(pot) to the arduino to control the intensity of each pin(red, green, blue). It did as it suppose to. When I turn the knob the brightness increase but as I'm reaching its maximum it drops back low again. So basically as I turn the knob gradually increasing, the brightness increase gradually from zero to it brightest then drops. I have attached a screenshot of this program below. I think it may be the connection between the pot and the arduino as they are quite sensitive but I'm not sure.       My second problem is when I replaced the single RGB LED with the RGB strip, MOSFETs(TIP120) and an external 12V supply it worked like before. I attached a couple of pictures of the layout below. However, when I set all the pins to low brightness the red and blue is turned off but the green led did not. The green led is dim but not completely turned off like the others. Why is this so? I'm very sure its not a defect in the strip. I hv also a attached a picture below of it.       My third problem is when I bought the three MOSFETs from the store I got one slightly different one although with the same label of TIP120. I have also attach a picture of the MOSFETS below.  The pin that is connected to this different MOSFET seems to act the opposite of its values. As in when I set that pin to low brightness it will be bright and vice versa unlike the other two. I can easily buy another one but I would like to know why this happens.       This is not really a problem but more of a question. As you can see I attached a 1k ohm resistor between the MOSFET and the arduino output to limit the draw of current. I would like to know what would you recommend the value of the resistor because I do not want to damage my chip. Is 1k enough?       My second question is I'm using a 12V 2A power adaptor as my power supply and a L7805 voltage regulator to provide a 5V power for my ATtiny84. However when I connect it I do not get a stable output and its value is around 5.3V. According to some videos I should attach a 0.1 microFarat electrolit capacitor to the input and a 22 microFarat electrolit capacitor to the output in parallel, however when I do so my output is still not stable and is around 5.8V which is too high for the chip as the max Vin for the chip is 5.5V. So what should I do?       My third and last question is my power adapter heats up when its powered but not connected to the circuit. Why is that? And my MOSFETS and voltage regulator gets hot occasionally. Should I attached a heat sink? Is this circuit possible to be left on 24/7? and how much power will it consume?       Sorry for the long post, I'm fairly new to electronics and I'm just a student  who is trying to learn electronics on my own. I have been working very hard on this project and I hope I get the best out of it. Sorry for the bad english too. Any help and comment will be much appreciated. Thank you very much!!

Question by KhayhenS 3 years ago  |  last reply 3 years ago


Instructablize Your Social Media! (aka YouTube)

Are you looking for the world's worst picture? Look at my profile picture! (As of now...) Since I've opened a new YT Channel, I decided that I'd make myself a channel intro (which I've already done) and nice banner, and most importantly: INSTRUCTABLIZE IT! (It would also be nice to have an option for a banner here on Instructables, since there is a lot of wasted space with the new update..) After a few hours*, I think I've finally come up with a nice one- See the screenshot below, if you're interested. (EDIT: Here is a link to may channel, in case I update it in the future, or if you'd like to give me some feedback-- I'd really appreciate that! :) It's not perfect, but I like it. I like how my name is in fairly bright green, the 24 is in blue. I also like how the robots hover all over the place, though I think I might have made them a bit too big... I made this with the Pixlr Editor, and if you want to make your own, feel free to use my image and modify it. If you do this too, don't forget to post a picture/ link to your channel below! EDIT: I forgot to write this, but this was actually my "second" try, since I tried to do something similar to this a few days ago... It is now a pinned (to the top) tweet on My Twitter (as of now, too...).  *This might look really simple, but it took me several hours to do this. Don't ask why!

Topic by Yonatan24 2 years ago  |  last reply 2 years ago


I have t-shirts older than you...

It's the weekend.I can wear t-shirts instead of the suit.So, I was browsing my pile wardrobe, when my eye fell upon my tee from the first Discworld Convention. 1996, a few weeks before #1 son was born.I dug deeper.One I bought at the first gig I went to with Kitewife, which makes it 22 years old.One I bought in Kenya, which makes it 24 years old.Good grief, I really do have clothes older than the vast majority of members here.They're all landmarks, though. Times and places that are important.It's weird - my t-shirts seem to be the only things I own that date me, that mark the passing of the years.I have books, lots of books, but most of them are still in print, in one form or another.I hunted around, and the only other things that I own which specifically pin down dates, anchor me in time, are my engagement ring (April 23rd, 1988) and my wedding ring (May 24th, 1990).What anchors you to certain dates? What anniversaries do you celebrate?What about your friends and families? What do they commemorate?What about the site? What anniversaries should we celebrate here? What is the exact start-date of the site? Are any of the Team approaching significant dates? I mean, look at them - there's not one of them over 21, surely?>Cue general philosophising on the nature of time and commemoration of its transit<

Topic by Kiteman 10 years ago  |  last reply 10 years ago


I have a problem in this code for Arduino UNO , Can you help me?

#include #include #define SOL_ADC A0     // Solar panel side voltage divider is connected to pin A0 #define BAT_ADC A1    // Battery side voltage divider is connected to pin A1 #define CURRENT_ADC A2  // ACS 712 current sensor is connected to pin A2 #define TEMP_ADC A3   // LM 35 Temperature is connected to pin A3 #define AVG_NUM 10    // number of iterations of the adc routine to average the adc readings #define BAT_MIN 10.5  // minimum battery voltage for 12V system #define BAT_MAX 15.0  // maximum battery voltage for 12V system #define BULK_CH_SP 14.4 // bulk charge set point for sealed lead acid battery // flooded type set it to 14.6V #define FLOAT_CH_SP 13.6  //float charge set point for lead acid battery #define LVD 11.5          //Low voltage disconnect setting for a 12V system #define PWM_PIN 3         // pin-3 is used to control the charging MOSFET //the default frequency is 490.20Hz #define LOAD_PIN 2       // pin-2 is used to control the load #define BAT_RED_LED 5 #define BAT_GREEN_LED 6 #define BAT_BLUE_LED 7 #define LOAD_RED_LED 8 #define LOAD_GREEN_LED 9 //-------------------------------------------------------------------------------------------------------------------------- ///////////////////////DECLARATION OF ALL BIT MAP ARRAY FOR FONTS//////////////////////////////////////////////////////////////// //-------------------------------------------------------------------------------------------------------------------------- byte solar[8] = //icon for solar panel {   0b11111,0b10101,0b11111,0b10101,0b11111,0b10101,0b11111,0b00000 }; byte battery[8] =  //icon for battery {   0b01110,0b11011,0b10001,0b10001,0b10001,0b10001,0b10001,0b11111 }; byte energy[8] =  // icon for power {   0b00010,0b00100,0b01000,0b11111,0b00010,0b00100,0b01000,0b00000 }; /*byte alarm[8] =  // icon for alarm { 0b00000,0b00100,0b01110,0b01110,0b01110,0b11111,0b00000,0b00100 };*/ byte temp[8] = //icon for termometer { 0b00100,0b01010,0b01010,0b01110,0b01110,0b11111,0b11111,0b01110 }; byte charge[8] = // icon for battery charge {   0b01010,0b11111,0b10001,0b10001,0b10001,0b01110,0b00100,0b00100, }; byte not_charge[8]= {   0b00000,0b10001,0b01010,0b00100,0b01010,0b10001,0b00000,0b00000, }; //-------------------------------------------------------------------------------------------------------------------------- ///////////////////////DECLARATION OF ALL GLOBAL VARIABLES////////////////////////////////////////////////////////////////// //-------------------------------------------------------------------------------------------------------------------------- float solar_volt=0; float bat_volt=0; float load_current=0; int temperature=0; int temp_change=0; float system_volt=0; float bulk_charge_sp=0; float float_charge_sp=0; float charge_status=0; float load_status=0; float error=0; float Ep=0; int duty =0; float lvd; float msec=0; float last_msec=0; float elasped_msec=0; float elasped_time=0; float ampSecs = 0; float ampHours=0; float watts=0; float wattSecs = 0; float wattHours=0; // Set the pins on the I2C chip used for LCD connections: //                    addr, en,rw,rs,d4,d5,d6,d7,bl,blpol LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);  // Set the LCD I2C address // In my case 0x27 //******************************************************* MAIN PROGRAM START ************************************************ void setup() { Serial.begin(9600); pinMode(BAT_RED_LED,OUTPUT); pinMode(BAT_GREEN_LED,OUTPUT); pinMode(BAT_BLUE_LED,OUTPUT); pinMode(LOAD_RED_LED ,OUTPUT); pinMode(LOAD_GREEN_LED,OUTPUT); pinMode(PWM_PIN,OUTPUT); pinMode(LOAD_PIN,OUTPUT); digitalWrite(PWM_PIN,LOW);  // default value of pwm duty cycle digitalWrite(LOAD_PIN,LOW);  // default load state is OFF lcd.begin(20,4);   // initialize the lcd for 16 chars 2 lines, turn on backlight lcd.backlight(); // finish with backlight on  lcd.createChar(1,solar); lcd.createChar(2, battery); lcd.createChar(3, energy); //lcd.createChar(4,alarm); lcd.createChar(5,temp); lcd.createChar(6,charge); lcd.createChar(7,not_charge); lcd.clear(); } void loop() { read_data();             // read different sensors data from analog pin of arduino system_voltage();        // detect the system voltage according to battery voltage setpoint();      // decide the charge set point according to system voltage charge_cycle();         // pwm charging of battery power();                // calculate the load power and energy load_control();         //control the load led_indication();       // led indica print_data();            // print in serial monitor lcd_display();           // lcd display } //************************************************************ PROGRAM END ************************************************* //------------------------------------------------------------------------------------------------------ ////////////////// READS AND AVERAGES THE ANALOG INPUTS (SOLRAR VOLTAGE,BATTERY VOLTAGE)//////////////// //------------------------------------------------------------------------------------------------------ int read_adc(int adc_parameter) {     int sum = 0;   int sample ;   for (int i=0; i   {                                        // loop through reading raw adc values AVG_NUM number of times      sample = analogRead(adc_parameter);    // read the input pin      sum += sample;                        // store sum for averaging     delayMicroseconds(50);              // pauses for 50 microseconds    }   return(sum / AVG_NUM);                // divide sum by AVG_NUM to get average and return it } //------------------------------------------------------------------------------------------------------------- ////////////////////////////////////READ THE DATA////////////////////////////////////////////////////////////// //------------------------------------------------------------------------------------------------------------- void read_data(void) {     //5V = ADC value 1024 => 1 ADC value = (5/1024)Volt= 0.0048828Volt     // Vout=Vin*R2/(R1+R2) => Vin = Vout*(R1+R2)/R2   R1=100 and R2=20      solar_volt = read_adc(SOL_ADC)*0.00488*(120/20);      bat_volt   = read_adc(BAT_ADC)*0.00488*(120/20);            load_current = (read_adc(CURRENT_ADC)*.0488 -25);      temperature = read_adc(TEMP_ADC)*0.00488*100;        }   //------------------------------------------------------------------------------------------------------------ /////////////////////////////////POWER AND ENERGY CALCULATION ////////////////////////////////////////////// //------------------------------------------------------------------------------------------------------------ void power(void) { msec = millis(); elasped_msec = msec - last_msec; //Calculate how long has past since last call of this function elasped_time = elasped_msec / 1000.0; // 1sec=1000 msec watts = load_current * bat_volt; //Watts now ampSecs = (load_current*elasped_time); //AmpSecs since last measurement wattSecs = ampSecs * bat_volt; //WattSecs since last measurement ampHours = ampHours + ampSecs/3600; // 1 hour=3600sec //Total ampHours since program started wattHours = wattHours + wattSecs/3600; // 1 hour=3600sec //Total wattHours since program started last_msec = msec; //Store 'now' for next time } //------------------------------------------------------------------------------------------------------------ /////////////////////////////////PRINT DATA IN SERIAL MONITOR///////////////////////////////////////////////// //------------------------------------------------------------------------------------------------------------   void print_data(void)   {     delay(100);     Serial.print("Solar Panel Voltage: ");     Serial.print(solar_volt);     Serial.println("V");     Serial.print("Battery Voltage: ");     Serial.print(bat_volt);     Serial.println("V");     Serial.print("Syestem Voltage: ");     Serial.print(system_volt);     Serial.println("V");     Serial.print("Charge Set Point:");     Serial.println(bulk_charge_sp);     Serial.print("Temperature:");     Serial.print(temperature);     Serial.println("C");     Serial.print("Load Current: ");     Serial.print(load_current);     Serial.println("A");     Serial.print("Power: ");     Serial.print(watts);     Serial.println("W");     Serial.print("Energy: ");     Serial.print(wattHours);     Serial.println("WH");     Serial.print("Duty Cycle :");     if (charge_status==1)     {     Serial.println("99%");     Serial.println("BULK CHARGING");     }     else if (charge_status==2)     {     Serial.print(Ep);     Serial.println("%");     Serial.println("FLOAT CHARGING");     }     else     {     Serial.println("0%");     Serial.println("NOT CHARGING");     }     if(load_status==1)     {      Serial.println("LOAD IS CONNECTED");     }     else     {      Serial.println("LOAD IS DISCONNECTED");       }        Serial.println("***************************"); } //---------------------------------------------------------------------------------------------------------------------- //////////////////////////////////SYSTEM VOLTAGE AUTO DETECT /////////////////////////////////////////////////////////// //---------------------------------------------------------------------------------------------------------------------- void system_voltage(void) {   if ((bat_volt >BAT_MIN) && (bat_volt < BAT_MAX))   {      system_volt = 12;   }   /*   else if  ((bat_volt > BAT_MIN*2 ) && (bat_volt < BAT_MAX*2))   {     system_volt=24;   }*/   else if ((bat_volt > BAT_MIN/2 ) && (bat_volt < BAT_MAX/2))   {     system_volt=6;   }   } //--------------------------------------------------------------------------------------------------------------------------- ////////////////////////////////////CHARGE SET POINT /////////////////////////////////////////////////////////////////////// //--------------------------------------------------------------------------------------------------------------------------- void setpoint(void) {   temp_change =temperature-25.0; // 25deg cel is taken as standard room temperature // temperature compensation = -5mv/degC/Cell   // If temperature is above the room temp ;Charge set point should reduced   // If temperature is bellow the room temp ;Charge set point should increased   if(system_volt ==12)   {      bulk_charge_sp = BULK_CH_SP-(0.030*temp_change) ;      float_charge_sp=FLOAT_CH_SP-(0.030*temp_change) ;      lvd =LVD;   }   else if(system_volt ==6)   {      bulk_charge_sp = (BULK_CH_SP/2)-(0.015*temp_change) ;      float_charge_sp= (FLOAT_CH_SP/2)-(0.015*temp_change) ;      lvd=LVD/2;   }   /*   else if (system_volt == 24)   {    bulk_charge_sp = (BULK_CH_SP*2)-(0.060*temp_change) ;    float_charge_sp= (FLOAT_CH_SP*2)-(0.060*temp_change) ;    lvd=LVD*2;   }   */   } //-------------------------------------------------------------------------------------------------------------------------------- ///////////////////////////////////////////////////PWM CHARGE CYCLE @500 HZ ////////////////////////////////////////////////// //------------------------------------------------------------------------------------------------------------------------------- void charge_cycle(void) {   if (solar_volt > bat_volt && bat_volt <= bulk_charge_sp)   {         if (bat_volt <= float_charge_sp) // charging start   {       charge_status = 1; // indicate the charger is in BULK mode      duty= 252.45;      analogWrite(PWM_PIN,duty); // 99 % duty cycle // rapid charging           }   else if (bat_volt >float_charge_sp && bat_volt <= bulk_charge_sp)   {         charge_status = 2; // indicate the charger is in FLOAT mode       error  = (bulk_charge_sp - bat_volt);      // duty cycle reduced when the battery voltage approaches the charge set point       Ep= error *100 ; //Ep= error* Kp // Assume  Kp=100             if(Ep < 0)        {         Ep=0;         }       else if(Ep>100)         {          Ep=100;         }       else if(Ep>0 && Ep <=100) // regulating        {          duty = (Ep*255)/100;        }        analogWrite(PWM_PIN,duty);    } }    else    {    charge_status=0;  // indicate the charger is OFF    duty=0;    analogWrite(PWM_PIN,duty);    } } //---------------------------------------------------------------------------------------------------------------------- /////////////////////////////////////////////LOAD CONTROL///////////////////////////////////////////////////// //----------------------------------------------------------------------------------------------------------------------    void load_control() { if (solar_volt < 5  ) // load will on when night {   if(bat_volt >lvd)   // check if battery is healthy   {   load_status=1;   digitalWrite(LOAD_PIN, HIGH); // load is ON   }   else if(bat_volt < lvd)   {     load_status=0;    digitalWrite(LOAD_PIN, LOW); //load is OFF   } } else // load will off during day {    load_status=0;    digitalWrite(LOAD_PIN, LOW); } } //------------------------------------------------------------------------------------------------- //////////////////////////LED INDICATION//////////////////////////////////// //------------------------------------------------------------------------------------------------- void led_indication(void) {   battery_led();           //Battery status led indication   load_led();              //Load led indication } //---------------------------------------------------------------------------------------------------------------------- /////////////////////////////////////////////BATTERY LED INDICATION///////////////////////////////////////////////////// //---------------------------------------------------------------------------------------------------------------------- void battery_led(void) {      if( (bat_volt > system_volt) && ( bat_volt   {         leds_off_all();       digitalWrite(BAT_GREEN_LED,LOW);  // battery voltage is healthy   }   else if(bat_volt >= bulk_charge_sp)   {       leds_off_all();       digitalWrite(BAT_BLUE_LED,LOW);  //battery is fully charged   }    else if(bat_volt < system_volt)   {       leds_off_all();       digitalWrite(BAT_RED_LED,LOW);  // battery voltage low   } } //---------------------------------------------------------------------------------------------------------------------- /////////////////////////////////////////////LOAD LED INDICATION///////////////////////////////////////////////////// //----------------------------------------------------------------------------------------------------------------------      void load_led()   {     if(load_status==1)     {       digitalWrite(LOAD_GREEN_LED,HIGH);     }     else if(load_status==0)     {       digitalWrite(LOAD_RED_LED,HIGH);     }    } //------------------------------------------------------------------------------------------------------ //////////////////////// TURN OFF ALL THE LED/////////////////////////////////////////////////////////// //------------------------------------------------------------------------------------------------------ void leds_off_all(void) {     digitalWrite(BAT_RED_LED,HIGH);   digitalWrite(BAT_GREEN_LED,HIGH);   digitalWrite(BAT_BLUE_LED,HIGH);   digitalWrite(LOAD_RED_LED, LOW);   digitalWrite(LOAD_GREEN_LED, LOW); } //------------------------------------------------------------------------------------------------------ //////////////////////// LCD DISPLAY/////////////////////////////////////////////////////////// //------------------------------------------------------------------------------------------------------ void lcd_display() { lcd.setCursor(0, 0); lcd.write(1); lcd.setCursor(2, 0); lcd.print(solar_volt); lcd.print("V"); lcd.setCursor(14, 0); lcd.write(5); lcd.setCursor(16, 0); lcd.print(temperature); lcd.write(0b11011111); lcd.print("C"); lcd.setCursor(0,1); lcd.write(2); lcd.setCursor(2, 1); lcd.print(bat_volt); lcd.print("V"); lcd.setCursor(14, 1); lcd.write(2); if((charge_status==1) | (charge_status== 2)) { lcd.write(6); } else { lcd.write(7); } lcd.setCursor(0,2); lcd.write(3); lcd.setCursor(2,2); lcd.print(load_current); lcd.print("A"); lcd.setCursor(13,2); lcd.print(watts); lcd.print("W"); lcd.setCursor(0,3); lcd.print("Energy:"); lcd.print(wattHours); lcd.print("WH");      }

Question by Fares Mareai 1 year ago  |  last reply 1 year ago


computer RAM upgrade stupid questions?

Well as it turns out, 8GB of RAM with Chrome and Kdenlive video editing software open at the same time causes Ubuntu to max out the RAM on my machine, and the machine will start to become very sluggish, eventually freezing for several minutes at a time with a high chance of never unfreezing. This used to be a very common issue that would occur with only google chrome open, due to a memory leak with my Gmail tabs. If I catch this sluggishness and eventually full system hang early enough, I can recover from it by entering CLI mode on ubuntu (alt+F1) and killing "chrome." After researching this problem a bit more, I created a swap file, since I do not have a SWAP partition, this helped delay the eventual unrecoverable system hang, but did not entirely fix the issue. I also tried different "swappiness" values, and also learned about this command "sudo sysctl -w vm.min_free_kbytes=400000" which supposedly forces a set amount of space to be unused in ubuntu. Looking at the system monitor this appears to do what it says, preventing a >95% RAM use, forcing swap to be used instead, and this was initially promising as it seemed to reduce the full system hangs, but created more small bugs, like freezing and stuttering wildly with buffered youtube videos, or playback in Kdenlive. A reboot seemed to have fixed that issue, but I'm not sure if those settings stuck around. ANYWAY; I guess there is no denying it, I simply do not have the RAM necessary for my workload anymore. I DO use intel HD integrated graphics, which uses the system RAM for graphics processing, so I wonder, will faster RAM allow slightly better graphics performance? My understanding is that GDDR is optimized for sheer bandwidth, not latency, while system DDRx RAM is optimized for latency. Does this mean my system will benefit more from high clock rate and high latency setting on a given RAM set, or is low clock and low latency RAM better? Most "gaming" orented builders seem to say RAM is not important other than esthetics and reliability. Also, is there a difference between buffered and unbuffered RAM?  Currently, the specs for my RAM are: Geil EVO Veloce GEV38GB1600C9DC 4GBx2 This RAM I got for "free" with my motherboard, and it seems to work with the following settings in the BIOS: . . .1600MHz @ 9-9-9-28 timings, 1.5V . . .1333MHz @ 9-9-9-24 timings, 1.5V . . .1800MHz @ 11-12-11-33 timings, 1.65V These are the fastest possible settings that will boot. Note, I was not too happy with the 1800MHz overclock, especially considering my computer was acting strange and crashed during an update, corrupting Ubuntu. I was able to repair the installation of some corrupted packages halfway installed. It did not seem to make any difference in some games on ubuntu, which is how I tested stability/speed. I have also had issues where while the BIOS system check passes, ubuntu puck errors all over me when I clocked at 1600MHz @ 9-9-9-24, even at 1.65V. There is really no overclocking this currently overpriced and mediocre RAM to any degree. The three settings above were the best settings I could get. The RAM I am currently looking at getting is: http://www.amazon.com/Crucial-Ballistix-PC3-12800-240-Pin-BLS2K4G3D169DS1J/dp/B00ZRG009S/ref=sr_1_1?s=pc&ie;=UTF8&qid;=1452056996&sr;=1-1&keywords;=BLS2K4G3D169DS1J It is the most affordable, and states that it is 4GBx2 of 1600MHz 9-9-9-24 RAM. I think I can underclock it to match the speed of the rest of my RAM and I think it should work well alongside. What do you guys think? I do not want to have to buy the $67 16GB if I can help it.

Question by -max- 3 years ago  |  last reply 3 years ago


Please help me solve this error in code

Arduino: 1.8.5 (Windows 8.1), Board: "Arduino/Genuino Uno"C:\Program Files (x86)\Arduino\libraries\NewSoftSerial-master\NewSoftSerial.cpp:39:24: fatal error: WConstants.h: No such file or directory #include "WConstants.h" ^compilation terminated.exit status 1 Error compiling for board Arduino/Genuino Uno.This report would have more information with "Show verbose output during compilation" option enabled in File -> Preferences./* JPEG Camera Example Sketch The sketch will take a picture on the JPEG Serial Camera and store the jpeg to an SD card on an SD Shield Written by Ryan Owens SparkFun ElectronicsHardware Notes: This sketch assumes the arduino has the microSD shield from SparkFun attached. The camera Rx/Tx should be attached to pins 2 and 3. IMPORTANT: The JPEG camera requires a TTL level shifter between the camera output and the arduino. Bypassing this may damage the Arduino pins. */This example requires the MemoryCard, SdFat, JPEGCamera and NewSoftSerial libraries #include #include #include #include #if defined(ARDUINO) && ARDUINO >= 100 #include "Arduino.h" #else #include "WProgram.h" #endif #include //Create an instance of the camera JPEGCamera camera;//Create a character array to store the cameras response to commands char response[32]; //Count is used to store the number of characters in the response string. unsigned int count=0; //Size will be set to the size of the jpeg image. int size=0; //This will keep track of the data address being read from the camera int address=0; //eof is a flag for the sketch to determine when the end of a file is detected //while reading the file data from the camera. int eof=0;void setup() { //Setup the camera, serial port and memory card camera.begin(); Serial.begin(9600); MemoryCard.begin(); //Reset the camera count=camera.reset(response); delay(3000); //Take a picture count=camera.takePicture(response); //Print the response to the 'TAKE_PICTURE' command. Serial.write((const uint8_t*)response, count); Serial.println(); //Get the size of the picture count = camera.getSize(response, &size;); //Print the size Serial.print("Size: "); Serial.println(size); //Create a file called 'test.txt' on the SD card. //NOTE: The memoryCard libary can only create text files. //The file has to be renamed to .jpg when copied to a computer. MemoryCard.open("/test.txt", true); //Starting at address 0, keep reading data until we've read 'size' data. while(address < size) { //Read the data starting at the current address. count=camera.readData(response, address); //Store all of the data that we read to the SD card for(int i=0; ivoid loop() {}

Topic by AhetekuD 11 months ago  |  last reply 11 months ago


I need help with my arduino code, the error code is "stray #" . located at #define DO_NEXT 4

1.//iOS switch control example 2.//Simple version 3.#define MY_DEBUG 1 4.#include "BluefruitRoutines.h" 5. 6.//Pin numbers for switches 7.#define PREVIOUS_SWITCH A0 8.#define SELECT_SWITCH A1 9.#define NEXT_SWITCH A2 10. 11.//Actions 12.#define DO_PREVIOUS 1 13.#define DO_SELECT   2 14.#define DO_NEXT     4 15. 16.uint8_t readSwitches(void) { 17.  return (~(digitalRead(PREVIOUS_SWITCH)*DO_PREVIOUS 18.      + digitalRead(SELECT_SWITCH)*DO_SELECT 19.      + digitalRead (NEXT_SWITCH)*DO_NEXT) 20.     ) & (DO_PREVIOUS+ DO_SELECT+ DO_NEXT); 21.} 22. 23.//Translate character to keyboard keycode and transmit 24.void pressKeyCode (uint8_t c) { 25.  ble.print(F("AT+BLEKEYBOARDCODE=00-00-")); 26.  uint8_t Code=c-'a'+4; 27.  if (Code<0x10)ble.print("0"); 28.  ble.print(Code,HEX); 29.  ble.println(F("-00-00-00-00")); 30.  MESSAGE(F("Pressed.")); 31.  delay(100);//de-bounce 32.  while (readSwitches()) { //wait for button to be released 33.    /*do nothing*/ 34.  }; 35.  ble.println(F("AT+BLEKEYBOARDCODE=00-00")); 36.  MESSAGE(F("Released")); 37.} 38. 39.void setup() { 40.  if(MY_DEBUG) 41.  while (! Serial) {}; delay (500); 42.  Serial.begin(9600); Serial.println("Debug output"); 43.endif 44.  pinMode(SELECT_SWITCH, INPUT_PULLUP); 45.  pinMode(NEXT_SWITCH, INPUT_PULLUP); 46.  pinMode(PREVIOUS_SWITCH, INPUT_PULLUP); 47.  initializeBluefruit(); 48.} 49. 50.void loop() { 51.  uint8_t i=readSwitches(); 52.  switch (i) { 53.    case DO_PREVIOUS: pressKeyCode('p'); break; 54.    case DO_SELECT:   pressKeyCode('s'); break; 55.    case DO_NEXT:     pressKeyCode('n'); break; 56.  } 57.} void setup() {   // put your setup code here, to run once: } void loop() {   // put your main code here, to run repeatedly: }

Question by JacLir00179 2 years ago  |  last reply 2 years ago


What components do I need to produce my 3 rechargeable Power-Packs using what ive collected so far ? Please can anyone help ?

Hello & Good day to you all, I'm making my own powerpacks for: a miniature wireless CCTV camera & receiver (Link Below for specs) , and a rechargeable powerpack to charge my laptop (that dies in 15minutes!) Wireless Pinhole Spy Camera & receiver After spending stupid money on sh*t 9 volt batteries (600mAh = £11 EACH) - ive had enough of the crap and absolutely absurdly LOW capacity 9 volt batteries out there (when TODAY's 'D' cell is capable of 11,000mAh !!!) and extremely high cost - i am making a battery-pack to power my receiver and another power-pack for the wireless camera using Ni-MH rechargeable batteries in the following packs: Powerpack 1 (for camera) 6 x 18650 cells @ 3.6v each, 5000mAh {Total Power=21.6v} Output Power Needed:  8v, 200mA Powerpack 2 (for camera receiver) 24 x D Size cells @ 1.2v each 11000mAh ( Total Power= 28.8v)  Output Power Needed: 12v, 500mA  Powerpack 3 (for Laptop) 40 x D cells @ 1.2v each, 11000mAh {Total Power=48v} Output Power Needed: 16v, 4A  I should add that my existing 9-volt (2 new & 1 old) rechargeable batteries are a little-more-than USELESS (Rated @ 175mAh...{USELESS}) as the receiver of my wireless camera drinks the power (juice, lol) at an extremely FAST-Rate... 15 minutes of use and its DEAD. 10 mins of use from the old 9 volt battery. And thats all from a 9 hour charge... How pitiful...Despicable & Disgusting... Now i got the idea to use a semiconductor from an instructable to make a simple solder-fume-extractor... (Link Below!) and also i know that resistors can reduce the voltage and amperage output of a circuit.......... Solder Fume Extractor I have calculated, researched, 'Googled', calculated again, more googling and after 6 months of trawling through the internet to find parts of designs i could hack together to achieve my goals including getting answers from "SO-CALLED-EXPERTS 'In the trade'" and from Circuitry & Electronics Forums (whom shall not be named...) yet they always say, yeah, here's my email address, email me your questions and when i do, they all turn around and gimmi some crap like "oh...well...you have your plan all set-out so what do you need me for ?" AS*HOLES! F*C*ING AS*HOLES!!! - If these peeps didnt want to help in the 1st place, then WHY BOTHER to give me their email address so i could ask them directly for help ? Im now going to give up and finally cry-out --- Please HELP (Again and probably for the last time!) ok ok, enough of the hell's-anger-fuelled-rage-at-"EXPERTS" who give me the run-around.....(Bcoz they're AS*HOLES...) Please please please can anyone help me find the components i need to make my very simple circuits for my battery packs ! I know that the use of a/a few? semiconductor/s (3 pin only) can let in a certain voltage and only output a specific voltage & amperage - i think i'll be needing a combination of a semiconductor and a resistor but i've searched continuous for 6 months now and am now irritated-beyond-belief that i still haven't found what im looking for or that no one is willing to help! ffs! Many thanks in advance for some light on this darn-troubling matter.... Please Help !!! Power-Specification For My Gear: Wireless Receiver: DC 12V 500mA Wireless Camera: DC 8V 200mA Sony Vaio Laptop 16v, 4A Also how do i charge my individual power-packs ? At what volts & amps do i charge them ??? Im already severely mobility-impaired and wouldn't want my life getting worse by any of my battery-packs exploding near me!!!!  Ingredients i have collected So Far: - 12 x 18650 5000mAh Batteries (Li-ion) (i want to make a total of two power-packs with these) - Solder Tabs for battery Packs -Small to medium collection of semiconductors + (plus) & - (minus) output voltages (from -24v to +25v) and from 100mA to 1.5mA amperage... - Heatshrink (40mm, 50mm, 70mm) - 24 x D cells @ 11000mAh - 40 x D cells @ 11000mAh I have no resistors but can order anything i need online if i only knew what to order!!! i would also need to include a circuit to prevent deep-discharge & over-charge! This is where i need the main help: I cannot read electrical diagrams at all but try to but it takes a day of deciphering and thats only if i do it right, i have dyslexia and am fighting daily with it when it comes to referring to any diagrams concerning circuits so would it be possible if someone could draw the circuits i need onto an a4 piece of paper and photograph it to be posted here (or draw it in paint, lol) - what i mean is, to draw a basic 3 pin semiconductor (a square with the 3 pins coming out the bottom, lol) and then draw the wires that need to connect to all the 3 pins to then for the wires to go to whatever component they need to go to next, for example ? {the 'solder-fume-extractor's' wiring picture where you can clearly-see where all the wires connect to all the components is the only type of simple diagram i can read by myself} Still wiht me ? i lose myself sometimes! So as i understand it, from what ive been reading so far, as long as the voltage output of the battery pack is correct, say for example for my wireless camera, if ive used a semiconductor to get the voltage of my power-pack down to give an output of 8v rated to 500mAh, as the device (wireless camera) only uses a max of 200mAh, then does this mean that the device will only use what it needs and ignore the rest ? Also it has taken a week of help from many friends of mine to help write this question and to keep it on-track with my main goals for the 3 power-packs listed above! if anyone needs more info, please let me know and i shall endeavor to reply as soon as humanly possible, again many thanks for your help Again, many thanks in advance for all help given and i sincerely apologize the long speech of a few questions, im afraid i get too-specific when asking for help (and often branch-off far-too-much, like now, lol)

Topic by offtherails2010 7 years ago


Arduino Countdown timer code problem?

I was using the Crazy Countdown Timer as a base for yet another project and I seem to have hit a dead end with the code. I have taken an input (A3) that used to speed up the countdown time and tried to change the function to add five minutes to the remaining time. I have tried various methods and the results have not been the best. From setting the total time to 5 minutes to it's current state of not doing anything at all, I have limited knowledge of the coding and would appreciate some help if you would be so kind. Thanks in advance :-) The code so far is /*   Arduino clock on a standard 4-digit clock display   Uses a Liteon LTC-617D1G clock display Connections: LTC - Arduino 1 - nc 2 - nc 3 - nc 4 - d7 5 - d3 6 - d2 7 - d11 8 - d10 9 - d4 10 - gnd 22 - d9 23 - d5 24 - d6 25 - A0  // because d13 already has a built-in LED getting in the way 26 - d8 27 - d12 28 - A1 29 - gnd button: 5v - button - A5 - 10k resistor - gnd crazy wires: 5v - red jumper wire - A4 - 10k resistor - gnd 5v - blue jumper wire - A3 - 10k resistor - gnd 5v - yellow jumper wire - A2 - 10k resistor - gnd Action: pin D13 is already hooked up to an LED */ #define DIGIT1 2 #define DIGIT2 3 #define DIGIT3 5 #define DIGIT4 6 #define SEGMENTA 7 #define SEGMENTB 8 #define SEGMENTC 9 #define SEGMENTD 10 #define SEGMENTE 11 #define SEGMENTF 12 #define SEGMENTG A0 #define COLON 4 #define AMPM A1 #define BUTTON A5 #define STOPWIRE  A2 #define PLUSFIVE A3 #define ZEROWIRE  A4 #define ACTION 13 #define ON  HIGH #define OFF LOW #define DELAYTIME 50 int FiveState;             // the current FiveRead from the input pin int lastFiveState = LOW;   // the previous FiveRead from the input pin long FivelastDebounceTime = 0;  // the last time the output pin was toggled long FiveDebounceDelay = 50;    // the debounce time; increase if the output flickers unsigned short hours, minutes, seconds; unsigned long lastTime; // keeps track of when the previous second happened int buttonState;             // the current reading from the button pin int lastButtonState = LOW;   // the previous reading from the button pin unsigned long button_down_start = 0; // how long the button was held down unsigned long lastDebounceTime = 0;  // the last time the output pin was toggled unsigned long debounceDelay = 50;    // the debounce time byte flash;    // indicates when display should be flashing byte flash_on; // indicates that display is current in "on" part of a flash byte timer_stopped; // indicates that the timer is not counting down #define ONE_SECOND 1000 #define FLASH_TIME 100 // 10 times as fast unsigned long time_chunk; void setup() {   // Serial.begin(9600);     // initialize all the required pins as output.   pinMode(DIGIT1, OUTPUT);   pinMode(DIGIT2, OUTPUT);   pinMode(DIGIT3, OUTPUT);   pinMode(DIGIT4, OUTPUT);   pinMode(SEGMENTA, OUTPUT);   pinMode(SEGMENTB, OUTPUT);   pinMode(SEGMENTC, OUTPUT);   pinMode(SEGMENTD, OUTPUT);   pinMode(SEGMENTE, OUTPUT);   pinMode(SEGMENTF, OUTPUT);   pinMode(SEGMENTG, OUTPUT);   pinMode(COLON, OUTPUT);   pinMode(AMPM, OUTPUT);     // button is input   pinMode(BUTTON, INPUT);     // wires are inputs   pinMode(STOPWIRE, INPUT);   pinMode(PLUSFIVE, INPUT);   pinMode(ZEROWIRE, INPUT);     // the action is output   pinMode(ACTION, OUTPUT);     // set the initial time   hours = 0;   minutes = 25;   seconds = 00;   flash = 0;   flash_on = 0;   timer_stopped = 0;   time_chunk = ONE_SECOND;   lastTime = millis(); } void loop() {     // Keep showing the display while waiting for timer to expire    while (millis() - lastTime < time_chunk) {             if (!flash || flash_on) {             if (hours > 0) {         clock_show_time(hours, minutes);             // and blink the colon every even second         if (seconds % 2 == 0) {           clock_show_colon();         }       }       else {         clock_show_time(minutes, seconds);         clock_show_colon(); // show a steady colon       }           }         // check the crazy wires         if (digitalRead(STOPWIRE) == HIGH) {  // stops time       timer_stopped = true;     }     else {       timer_stopped = false;     }     /*     if (digitalRead(SPEEDWIRE) == HIGH) { // speeds up the time and flashes display       flash = 1;       time_chunk = FLASH_TIME;     }     */          // read the state of the switch into a local variable:   int FiveRead = digitalRead(PLUSFIVE);   // check to see if you just pressed the button   // (i.e. the input went from LOW to HIGH),  and you've waited   // long enough since the last press to ignore any noise:    // If the switch changed, due to noise or pressing:   if (FiveRead != lastFiveState) {     // reset the debouncing timer     FivelastDebounceTime = millis();   }     if ((millis() - FivelastDebounceTime) > FiveDebounceDelay) {     // whatever the FiveRead is at, it's been there for longer     // than the debounce delay, so take it as the actual current state:     // if the button state has changed:     if (FiveRead != FiveState) {       FiveState = FiveRead;       // only toggle the LED if the new button state is HIGH       if (FiveState == HIGH) {         minutes += 5;       if (minutes > 59) minutes = 59;           }                     // button has been pressed           incrementTime();         }     // save the FiveRead.  Next time through the loop,   // it'll be the lastFiveState:   lastFiveState = FiveRead;    }        if (digitalRead(ZEROWIRE) == HIGH) {  // sets time to zero       hours = 0;       minutes = 0;       seconds = 0;       time_chunk = FLASH_TIME;     }         // button presses increase minutes     int reading = digitalRead(BUTTON);      // If the switch changed, due to noise or pressing:     if (reading != lastButtonState) {       // reset the debouncing timer       lastDebounceTime = millis();     }         if ((millis() - lastDebounceTime) > debounceDelay) {       // whatever the reading is at, it's been there for longer       // than the debounce delay, so take it as the actual current state:             if (buttonState != reading) {         button_down_start = millis(); // record the start of the current button state       }             buttonState = reading;             // buttonState is now either on or off       if (buttonState == HIGH) {         flash = 0; // takes it out of panic mode         digitalWrite(ACTION, OFF); // turns the action OFF.         time_chunk = ONE_SECOND; // reset to regular time counting.                   // slow it down by only doing this every 10th millisecond         if ((millis() % 10) == 0) {           // if the button was held down more than 5 seconds, make it go faster           if ((millis() - button_down_start) > 5000) {             seconds += 10;             if (seconds > 59) seconds = 59;           }                     // button has been pressed           incrementTime();         }       }     }     lastButtonState = reading;   }   lastTime += time_chunk;     if (!timer_stopped) {     decrementTime();   }     if (flash) {     flash_on = !flash_on;   } } // // a call to decrementTime decreases time by one second. // void decrementTime() {       if (seconds == 0) {               if (minutes == 0) {                   if (hours == 0) {                      // time is at 00:00, flash the zeroes             flash = 1;             time_chunk = FLASH_TIME;                               // and do the action             do_action();           }           else {             minutes = 59;             hours--;           }         }         else {           seconds = 59;           minutes--;         }               }       else {         seconds--;        } } // // a call to incrementTime increases time by one second. // void incrementTime() {     if (seconds == 59) {     seconds = 0;         if (minutes == 59) {       minutes = 0;             if (hours == 12) {                  hours = 1;       }       else {         hours++;       }     }     else {       minutes++;     }   }   else {     seconds++;    } } // // clock_show_time - displays the given time on the clock display //   Note that instead of hr/min the user can also send min/sec //   Maximum hr is 99, Maximum min is 59, and minimum is 0 for both (it's unsigned, heh). // void clock_show_time(unsigned short hours, unsigned short minutes) {   unsigned short i;   unsigned short delaytime;   unsigned short num_leds[10] = { 6, 2, 5, 5, 4, 5, 6, 3, 7, 6 };   unsigned short digit[4];   unsigned short hide_leading_hours_digit;       // convert minutes and seconds into the individual digits   // check the boundaries   if (hours > 99) hours = 99;   if (minutes > 59) minutes = 59;     // convert hr   if (hours < 10 && hours > 0) {     hide_leading_hours_digit = 1;   }   else {     hide_leading_hours_digit = 0;   }     digit[0] = hours / 10;   digit[1] = hours % 10; // remainder   digit[2] = minutes / 10;   digit[3] = minutes % 10; // remainder    for (i = hide_leading_hours_digit; i < 4; i++) {     clock_all_off();     clock_show_digit(i, digit[i]);     // fewer leds = brighter display, so delay depends on number of leds lit.     delaytime = num_leds[digit[i]] * DELAYTIME;       delayMicroseconds(delaytime);   }       clock_all_off(); } // // clock_all_off - turns off all the LEDs on the clock to give a blank display // void clock_all_off(void) {     // digits must be ON for any LEDs to be on   digitalWrite(DIGIT1, OFF);   digitalWrite(DIGIT2, OFF);   digitalWrite(DIGIT3, OFF);   digitalWrite(DIGIT4, OFF);     // segments must be OFF for any LEDs to be on   digitalWrite(SEGMENTA, ON);   digitalWrite(SEGMENTB, ON);   digitalWrite(SEGMENTC, ON);   digitalWrite(SEGMENTD, ON);   digitalWrite(SEGMENTE, ON);   digitalWrite(SEGMENTF, ON);   digitalWrite(SEGMENTG, ON);     // turn off colon and alarm too   digitalWrite(COLON, OFF);   digitalWrite(AMPM, OFF); } // // clock_show_digit - turns on the LEDs for the digit in the given position //      position can be from 0 through 3: 0 and 1 being the hour, 2 and 3 being the seconds //      value can be from 0 through 9, ie, a valid single digit. // //      (if value is out of range, it displays a 9. if digit is out of range display remains blank) // void clock_show_digit(unsigned short position, unsigned short value) {   byte a;   byte b;   byte c;   byte d;   byte e;   byte f;   byte g;   switch (position) {     case 0:       digitalWrite(DIGIT1, ON);       break;     case 1:       digitalWrite(DIGIT2, ON);       break;     case 2:       digitalWrite(DIGIT3, ON);       break;     case 3:       digitalWrite(DIGIT4, ON);       break;   }   a = !(value == 1 || value == 4);   b = !(value == 5 || value == 6);   c = !(value == 2);   d = !(value == 1 || value == 4 || value == 7);   e =  (value == 0 || value == 2 || value == 6 || value == 8);   f = !(value == 1 || value == 2 || value == 3 || value == 7);   g = !(value == 0 || value == 1 || value == 7);     if (a) digitalWrite(SEGMENTA, OFF);   if (b) digitalWrite(SEGMENTB, OFF);   if (c) digitalWrite(SEGMENTC, OFF);   if (d) digitalWrite(SEGMENTD, OFF);   if (e) digitalWrite(SEGMENTE, OFF);   if (f) digitalWrite(SEGMENTF, OFF);   if (g) digitalWrite(SEGMENTG, OFF); } // // clock_show_colon - shows the colon that separates minutes from seconds // void clock_show_colon(void) {   unsigned short delaytime;   digitalWrite(COLON, ON);                                // 2 leds = 2 delays needed   delaytime = DELAYTIME * 2;  // must use variable to have similar delay to rest of clock   delayMicroseconds(delaytime);   //   because use of variable slows it down slightly.   digitalWrite(COLON, OFF); } // // clock_show_alarm - shows the ampm dot (bottom right of clock display) // void clock_show_ampm(void) {   unsigned short delaytime;   digitalWrite(AMPM, ON);                         delaytime = DELAYTIME;  // must use variable to have similar delay to rest of clock   delayMicroseconds(delaytime);   //   because use of variable slows it down slightly.   digitalWrite(AMPM, OFF); } // // do_action - this function gets called when the timer completes. // static void do_action(void) {   // the exciting action here is just to turn on a LED   digitalWrite(ACTION, ON);   Serial.println("ACTION!"); }

Question by Djandco 4 years ago  |  last reply 4 years ago


Music Shield crash

Hey! I need a help, i used te Music Shield v2.0 With audio analyser v2.0.. I play  1 or 2 songs he crashes, why? Sorry my english, im portuguese this is code i used: #include #include #include #include int analogPin = 5; // MSGEQ7 OUT 3 int strobePin = 12; // MSGEQ7 STROBE 4 int resetPin = 11; // MSGEQ7 RESET 7 int spectrumValue[7]; // MSGEQ7 OUT pin produces values around 50-80 int filterValue = 65; // 1 Bola int bola1 = 23; // 2 Bola int bola2 = 24; // 3 Bola int bola3 = 25; // 4 Bola int bola4 = 26; // 5 Bola int bola5 = 27; // 6 Bola int bola6 = 28; // 7 Bola int bola7 = 29; int Val1=0; int Val2=0; int Val3=0; int Val4=0; int Val5=0; int Val6=0; int Val7=0; void setup() {   pinMode(bola1, OUTPUT);   pinMode(bola2, OUTPUT);   pinMode(bola3, OUTPUT);   pinMode(bola4, OUTPUT);   pinMode(bola5, OUTPUT);   pinMode(bola6, OUTPUT);   pinMode(bola7, OUTPUT);   Serial.begin(9600);   player.keyDisable(); //keys disable first;   player.analogControlEnable(); //enable to scan the A4/A5   player.begin(); //will initialize the hardware and set default mode to be normal.   player.setPlayMode(PM_REPEAT_LIST); //set mode to repeat to play List   player.attachAnalogOperation(A4, adjustVolume); //Grove - Rotary Angle Sensor connected to A4,to control the volume   player.scanAndPlayAll(); //If the current playlist is empty,it will add all the songs in the root directory to the playlist.   Serial1.begin(1200);   pinMode(analogPin, INPUT);   pinMode(strobePin, OUTPUT);   pinMode(resetPin, OUTPUT);   analogReference(DEFAULT);   digitalWrite(resetPin, LOW);   digitalWrite(strobePin, HIGH); } void loop(void) { // Set reset pin low to enable strobe digitalWrite(resetPin, HIGH); digitalWrite(resetPin, LOW); // Get all 7 spectrum values from the MSGEQ7 for (int i = 0; i < 7; i++) { digitalWrite(strobePin, LOW); delayMicroseconds(30); // Allow output to settle spectrumValue[i] = analogRead(analogPin); // Constrain any value above 1023 or below filterValue spectrumValue[i] = constrain(spectrumValue[i], filterValue, 1023); // Remap the value to a number between 0 and 255 spectrumValue[i] = map(spectrumValue[i], filterValue, 1023, 0, 255); // Remove serial stuff after debugging Serial.print(spectrumValue[i]); Serial.print(" "); digitalWrite(strobePin, HIGH); } Serial.println("Analisador de som"); // 1 Bola if(spectrumValue[0]>150) {   Val1 =spectrumValue[0]; } analogWrite(bola1, Val1); if(spectrumValue[0]<110) {   Val1 =0; } analogWrite(bola1, Val1); // 2 Bola if(spectrumValue[1]>150) {   Val2 =spectrumValue[1]; } analogWrite(bola2, Val2); if(spectrumValue[1]<110) {   Val2 =0; } analogWrite(bola2, Val2); // 3 Bola if(spectrumValue[2]>150) {   Val3 =spectrumValue[2]; } analogWrite(bola3, Val3); if(spectrumValue[2]<110) {   Val3 =0; } analogWrite(bola3, Val3); // 4 Bola if(spectrumValue[3]>150) {   Val4 =spectrumValue[3]; } analogWrite(bola4, Val4); if(spectrumValue[3]<110) {   Val4 =0; } analogWrite(bola4, Val4); // 5 Bola if(spectrumValue[4]>150) {   Val5 =spectrumValue[4]; } analogWrite(bola5, Val5); if(spectrumValue[4]<110) {   Val5 =0; } analogWrite(bola5, Val5); // 6 Bola if(spectrumValue[5]>150) {   Val6 =spectrumValue[5]; } analogWrite(bola6, Val6); if(spectrumValue[5]<110) {   Val6 =0; } analogWrite(bola6, Val6); // 7 Bola if(spectrumValue[6]>150) {   Val7 =spectrumValue[6]; } analogWrite(bola7, Val7); if(spectrumValue[6]<110) {   Val7 =0; } { analogWrite(bola7, Val7); Serial1.println("Music Shield"); } player.play(); } void adjustVolume(void) //User-defined function { unsigned int vol_temp = analogRead(A4); unsigned char volume = vol_temp / 12; { if (volume == 0x55) volume = MAXVOL; //MAXVOL = 0xfe; player.setVolume(volume); } }

Topic by Jardel17 3 years ago  |  last reply 3 years ago


Monster hunter

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Full combination list : +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1.Potion = Blue Mushroom + Herb 2.Mega Potion = Potion(1)+ Honey 3.Nutrients = Blue Mushroom + Godbug 4.Mega Nutrients = Nutrients(3)+ Honey 5.Antidote = Antidote Herb + Blue Mushroom 6.Herbal Medicine = Cactus Flower + Bitterbug 7.Max Potion = Mega Nutrients(4)+ Dragon Toadstool 8.Ancient Potion = Imunizer(10)+ Kelbi Horn 9.Catalyst=Bitterbug+Honey 10.Imunizer=Catalyst(9)+Dragon Toadstool 11.Power Juice=Catalyst(9)+Rare Steak 12.Mega Juice = Power Extract + Well Done Steak 13.Demondrug = Catalyst(9)+ Power Seed 14.Mega Demondrug = Pale Extract + Demondrug(13) 15.Armourskin = Catalyst(9)+ Armour Seed 16.Mega Armourskin = Pale Extract + Armourskin(15) 17.Poisoned Meat = Raw Meat + Toadstool 18.Tainted Meat = Raw Meat + Stunshroom 19.Drugged Meat = Raw Meat + Sleep Herb 20.Bomb Material = Stone + Sap Plant 21.Smoke Bomb = Bomb Material(20)+ Ivy 22.Flash Bomb = Bomb Material(20)+ Flashbug 23.Dung Bomg = Bomb Material(20)+ Dung 24.Paintball = Paintberry + Sap Plant 25.Gunpowder = Nitroshroom + Fire Herb 26.Small Barrel Bomb = Small Barrel + Fire Herb 27.Large Barrel Bomb = Large Barrel + Gunpowder(25) 28.Sonic Bomb = Gunpowder(25)+ Screamer 29.Net = Spiderweb + Ivy 30.Pitfall Trap = Net(29)+ Trap Tool 31.Tuna Bait = Worm + Yambug 32.Arrowana Bait = Cricket + Bughopper 33.Goldenfish Bait = Firefly + Snakebee Larva 34.Antiseptic Stone = Bitterbug + Earth Crystal 35.Lifecrystals = Godbug + Wyvern Fang 36.Lifepowder = Lifecrystals(35)+ Wyvern Claw 37.Health Flute = Lifepowder(36)+ Flute 38.Antidote flute = Antiseptic stone(34)+ Flute 39.Demon Flute = Mega Demondrug(13)+ Med Monster Bone 40.Armour Flute = Mega Armourskin(15) + Med Monster Bone 41.Normal S Lv2 = Huskberry + Needleberry 42.Normal S Lv3 = Huskberry + Rumblefish 43.Pierce S Lv1 = Huskberry + Velociprey Fang 44.Pierce S Lv2 = Huskberry + Pin Tuna 45.Pierce S Lv3 = Sm Bone Husk + Pin Tuna 46.Pellet S Lv1 = Huskberry + Scatternut 47.Pellet S Lv2 = Huskberry + Wyvern Fang 48.Pellet S Lv3 = Sm Bone Husk + Wyvern Fang 49.Crag S Lv1 = Huskberry + Burst Arrowana 50.Crag S Lv2 = Sm Bone Husk + Burst Arrowana 51.Crag S Lv3 = Lg Bone Husk + Bomb Arrowana 52.Clust S Lv1 = Huskberry + Bomberry 53.Clust S Lv2 = Sm Bone Husk + Wyvern Claw 54.Clust S Lv3 = Lg Bone Husk + Scatterfish 55.Disk S = Huskberry + Disk Stone 56.Recover S Lv1 = Huskberry + Herb 57.Recover S Lv2 = Huskberry + Potion(1) 58.Poison S Lv1 = Huskberry + Toadstool 59.Poison S Lv2 = Sm Bone Husk + Ioprey Fang 60.Stun S Lv1 = Huskberry + Stunshroom 61.Stun S Lv2 = Sm Bone Husk + Genprey Fang 62.Sleep S Lv1 = Huskberry + Sleep Herb 63.Sleep S Lv2 = Sm Bone Husk + Sleepyfish 64.Paint S = Huskberry + Paintberry 65.Antidote S = Huskberry + Antidote Herb 66.Demon S= Huskberry + Power Seed 67.Armour S = Huskberry + Armour Seed 68.Dragon S = Lg Bone Husk + Dragon Seed 69.Dung S = Huskberry + Dung Now dont ask for Items combinations anymore they all are here... once i get MHF I'll add the new ones if theres some

Topic by jellybean10122 10 years ago


RadioShack Tri Color LED strip light show help?

I'm having partial success creating a synchronized light show by calling some colors and adding delays. My main problem is creating specific colors or even displaying one color on the entire strip.  here's the default code for the strip for arduino: #include // ******** DEBUG ==== should auto config to adapt different mother board ********* //#define DATA_1 (PORTF |=  0X01)    // DATA 1    // for ATMEGA //#define DATA_0 (PORTF &=  0XFE)    // DATA 0    // for ATMEGA //#define STRIP_PINOUT DDRF=0xFF  // for ATMEGA #define DATA_1 (PORTC |=  0X01)    // DATA 1    // for UNO #define DATA_0 (PORTC &=  0XFE)    // DATA 0    // for UNO #define STRIP_PINOUT (DDRC=0xFF)    // for UNO PROGMEM const unsigned long pattern_test_red[10][10]={   {0xff0000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0xff0000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0xff0000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0xff0000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0xff0000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0xff0000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0xff0000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0xff0000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0xff0000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0xff0000}, }; PROGMEM const unsigned long pattern_test_blue[10][10]={   {0x00ff00,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x00ff00,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x00ff00,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x00ff00,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x00ff00,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x00ff00,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x00ff00,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x00ff00,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x00ff00,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x00ff00}, }; PROGMEM const unsigned long pattern_test_green[10][10]={   {0x0000ff,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x0000ff,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x0000ff,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x0000ff,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x0000ff,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x0000ff,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x0000ff,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x0000ff,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x0000ff,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x0000ff}, }; PROGMEM const unsigned long pattern_test_white[10][10]={   {0xffffff,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0xffffff,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0xffffff,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0xffffff,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0xffffff,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0xffffff,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0xffffff,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0xffffff,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0xffffff,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0xffffff}, }; PROGMEM const unsigned long pattern_test_comet1[][10]={   {0xffffff,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x444444,0xffffff,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x111111,0x444444,0xffffff,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x111111,0x444444,0xffffff}, }; PROGMEM const unsigned long pattern_test_comet2[][10]={   {0xffffff,0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000,0x000000,0x000000},   {0x444444,0xffffff,0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000,0x000000},   {0x111111,0x444444,0xffffff,0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000},   {0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000},   {0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000,0x111111,0x444444,0xffffff},   {0xffffff,0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000,0x000000,0x000000},   {0x444444,0xffffff,0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000,0x000000},   {0x111111,0x444444,0xffffff,0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000},   {0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000},   {0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000,0x111111,0x444444,0xffffff}, }; PROGMEM const unsigned long pattern_test_comet3[][10]={   {0xffffff,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0xffffff},   {0x444444,0xffffff,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0xffffff,0x444444},   {0x111111,0x444444,0xffffff,0x000000,0x000000,0x000000,0x000000,0xffffff,0x444444,0x111111},   {0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000,0xffffff,0x444444,0x111111,0x000000},   {0x000000,0x000000,0x111111,0x444444,0xffffff,0xffffff,0x444444,0x111111,0x000000,0x000000},   {0x000000,0x000000,0x111111,0x444444,0xffffff,0xffffff,0x444444,0x111111,0x000000,0x000000},   {0x000000,0x000000,0x000000,0xffffff,0x444444,0x444444,0xffffff,0x000000,0x000000,0x000000},   {0x000000,0x000000,0xffffff,0x444444,0x111111,0x111111,0x444444,0xffffff,0x000000,0x000000},   {0x000000,0xffffff,0x444444,0x111111,0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000},   {0xffffff,0x444444,0x111111,0x000000,0x000000,0x000000,0x000000,0x111111,0x444444,0xffffff}, }; PROGMEM const unsigned long pattern_test_rainbow[10][10]={   {0xff0000,0xff7f00,0xffff00,0x00ff00,0x0000ff,0x6f00ff,0x8f00ff,0x000000,0x000000,0x000000},   {0x000000,0xff0000,0xff7f00,0xffff00,0x00ff00,0x0000ff,0x6f00ff,0x8f00ff,0x000000,0x000000},   {0x000000,0x000000,0xff0000,0xff7f00,0xffff00,0x00ff00,0x0000ff,0x6f00ff,0x8f00ff,0x000000},   {0x000000,0x000000,0x000000,0xff0000,0xff7f00,0xffff00,0x00ff00,0x0000ff,0x6f00ff,0x8f00ff},   {0x8f00ff,0x000000,0x000000,0x000000,0xff0000,0xff7f00,0xffff00,0x00ff00,0x0000ff,0x6f00ff},   {0x6f00ff,0x8f00ff,0x000000,0x000000,0x000000,0xff0000,0xff7f00,0xffff00,0x00ff00,0x0000ff},   {0x0000ff,0x6f00ff,0x8f00ff,0x000000,0x000000,0x000000,0xff0000,0xff7f00,0xffff00,0x00ff00},   {0x00ff00,0x0000ff,0x6f00ff,0x8f00ff,0x000000,0x000000,0x000000,0xff0000,0xff7f00,0xffff00},   {0xffff00,0x00ff00,0x0000ff,0x6f00ff,0x8f00ff,0x000000,0x000000,0x000000,0xff0000,0xff7f00},   {0xff7f00,0xffff00,0x00ff00,0x0000ff,0x6f00ff,0x8f00ff,0x000000,0x000000,0x000000,0xff0000}, }; // *********************************************************************************************************** // * // *                            Power Up Init. // * // * // *********************************************************************************************************** void setup() {                  STRIP_PINOUT;        // set output pin - DEBUG: should auto detect which mother board for use   reset_strip();   //noInterrupts(); } // *********************************************************************************************************** // * // *                            Main Loop // * // * // *********************************************************************************************************** void loop() {   send_1M_pattern(pattern_test_red, 10, 500);   delay(500);   send_1M_pattern(pattern_test_blue, 10, 500);   delay(500);   send_1M_pattern(pattern_test_green, 10, 500);   delay(500);   send_1M_pattern(pattern_test_white, 10, 500);   delay(500);   send_1M_pattern(pattern_test_comet1, 10, 70);   delay(500);   send_1M_pattern(pattern_test_comet2, 10, 70);   delay(500);   send_1M_pattern(pattern_test_comet3, 10, 70);   delay(500);         while (1)   {     send_1M_pattern(pattern_test_rainbow, 10, 70);   }   /* frame++;     if(frame<=10) LEDSTRIP_PATTERN_0();     if(10     if(20     if(frame>30) frame=1;    */   //delay(1); } /******************************************************************************* * Function Name  : send_1M_pattern * Description    : Transmit pattern to whole 1 meter strip *                  * Input          : pointer to ROM pattern; pattern length; frame rate *                  * Output         : None * Return         : None *******************************************************************************/ void send_1M_pattern(const unsigned long data[][10], int pattern_no, int frame_rate) {   int i=0;   int j=0;   uint32_t temp_data;   for (i=0;i   {     noInterrupts();     for (j=0;j<10;j++)     {       temp_data=pgm_read_dword_near(&data;[i][j]);       send_strip(temp_data);     }     interrupts();     delay(frame_rate);   } } /******************************************************************************* * Function Name  : send_strip * Description    : Transmit 24 pulse to LED strip *                  * Input          : 24-bit data for the strip *                  * Output         : None * Return         : None *******************************************************************************/ void send_strip(uint32_t data) {   int i;   unsigned long j=0x800000;     for (i=0;i<24;i++)   {     if (data & j)     {       DATA_1;       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");          __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       /*----------------------------*/       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");        __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");        __asm__("nop\n\t");        __asm__("nop\n\t");        /*----------------------------*/            DATA_0;     }     else     {       DATA_1;       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");          DATA_0; /*----------------------------*/             __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");      /*----------------------------*/             }     j>>=1;   }   } /******************************************************************************* * Function Name  : reset_strip * Description    : Send reset pulse to reset all color of the strip *                  * Input          : None *                  * Output         : None * Return         : None *******************************************************************************/ void reset_strip() {   DATA_0;   delayMicroseconds(20); } //***********AND HERE"S MY MODIFIED LIGHT SHOW CODE:*********** #include // ******** DEBUG ==== should auto config to adapt different mother board ********* //#define DATA_1 (PORTF |=  0X01)    // DATA 1    // for ATMEGA //#define DATA_0 (PORTF &=  0XFE)    // DATA 0    // for ATMEGA //#define STRIP_PINOUT DDRF=0xFF  // for ATMEGA #define DATA_1 (PORTC |=  0X01)    // DATA 1    // for UNO #define DATA_0 (PORTC &=  0XFE)    // DATA 0    // for UNO #define STRIP_PINOUT (DDRC=0xFF)    // for UNO PROGMEM const unsigned long pattern_test_red[10][10]={   {0xff0000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0xff0000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0xff0000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0xff0000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0xff0000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0xff0000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0xff0000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0xff0000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0xff0000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0xff0000}, }; PROGMEM const unsigned long pattern_test_blue[10][10]={   {0x00ff00,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x00ff00,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x00ff00,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x00ff00,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x00ff00,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x00ff00,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x00ff00,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x00ff00,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x00ff00,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x00ff00}, }; PROGMEM const unsigned long pattern_test_green[10][10]={   {0x0000ff,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x0000ff,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x0000ff,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x0000ff,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x0000ff,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x0000ff,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x0000ff,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x0000ff,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x0000ff,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x0000ff}, }; PROGMEM const unsigned long pattern_test_white[10][10]={   {0xffffff,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0xffffff,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0xffffff,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0xffffff,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0xffffff,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0xffffff,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0xffffff,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0xffffff,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0xffffff,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0xffffff}, }; PROGMEM const unsigned long pattern_test_comet1[][10]={   {0xffffff,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x444444,0xffffff,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x111111,0x444444,0xffffff,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x111111,0x444444,0xffffff}, }; PROGMEM const unsigned long pattern_test_comet2[][10]={   {0xffffff,0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000,0x000000,0x000000},   {0x444444,0xffffff,0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000,0x000000},   {0x111111,0x444444,0xffffff,0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000},   {0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000},   {0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000,0x111111,0x444444,0xffffff},   {0xffffff,0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000,0x000000,0x000000},   {0x444444,0xffffff,0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000,0x000000},   {0x111111,0x444444,0xffffff,0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000},   {0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000},   {0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000,0x111111,0x444444,0xffffff}, }; PROGMEM const unsigned long pattern_test_comet3[][10]={   {0xffffff,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0xffffff},   {0x444444,0xffffff,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0xffffff,0x444444},   {0x111111,0x444444,0xffffff,0x000000,0x000000,0x000000,0x000000,0xffffff,0x444444,0x111111},   {0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000,0xffffff,0x444444,0x111111,0x000000},   {0x000000,0x000000,0x111111,0x444444,0xffffff,0xffffff,0x444444,0x111111,0x000000,0x000000},   {0x000000,0x000000,0x111111,0x444444,0xffffff,0xffffff,0x444444,0x111111,0x000000,0x000000},   {0x000000,0x000000,0x000000,0xffffff,0x444444,0x444444,0xffffff,0x000000,0x000000,0x000000},   {0x000000,0x000000,0xffffff,0x444444,0x111111,0x111111,0x444444,0xffffff,0x000000,0x000000},   {0x000000,0xffffff,0x444444,0x111111,0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000},   {0xffffff,0x444444,0x111111,0x000000,0x000000,0x000000,0x000000,0x111111,0x444444,0xffffff}, }; PROGMEM const unsigned long pattern_test_rainbow[10][10]={   {0xff0000,0xff7f00,0xffff00,0x00ff00,0x0000ff,0x6f00ff,0x8f00ff,0x000000,0x000000,0x000000},   {0x000000,0xff0000,0xff7f00,0xffff00,0x00ff00,0x0000ff,0x6f00ff,0x8f00ff,0x000000,0x000000},   {0x000000,0x000000,0xff0000,0xff7f00,0xffff00,0x00ff00,0x0000ff,0x6f00ff,0x8f00ff,0x000000},   {0x000000,0x000000,0x000000,0xff0000,0xff7f00,0xffff00,0x00ff00,0x0000ff,0x6f00ff,0x8f00ff},   {0x8f00ff,0x000000,0x000000,0x000000,0xff0000,0xff7f00,0xffff00,0x00ff00,0x0000ff,0x6f00ff},   {0x6f00ff,0x8f00ff,0x000000,0x000000,0x000000,0xff0000,0xff7f00,0xffff00,0x00ff00,0x0000ff},   {0x0000ff,0x6f00ff,0x8f00ff,0x000000,0x000000,0x000000,0xff0000,0xff7f00,0xffff00,0x00ff00},   {0x00ff00,0x0000ff,0x6f00ff,0x8f00ff,0x000000,0x000000,0x000000,0xff0000,0xff7f00,0xffff00},   {0xffff00,0x00ff00,0x0000ff,0x6f00ff,0x8f00ff,0x000000,0x000000,0x000000,0xff0000,0xff7f00},   {0xff7f00,0xffff00,0x00ff00,0x0000ff,0x6f00ff,0x8f00ff,0x000000,0x000000,0x000000,0xff0000}, }; // *********************************************************************************************************** // * // *                            Power Up Init. // * // * // *********************************************************************************************************** void setup() {                  STRIP_PINOUT;        // set output pin - DEBUG: should auto detect which mother board for use   reset_strip();   //noInterrupts(); } // *********************************************************************************************************** // * // *                            Main Loop // * // * // *********************************************************************************************************** void loop() {   send_1M_pattern(pattern_test_white, 0, 0);   delay(36000);   send_1M_pattern(pattern_test_white, 500,0);   delay(5000);   send_1M_pattern(pattern_test_white, 10, 70);   delay(10);   send_1M_pattern(pattern_test_white, 10, 70);   delay(10);   send_1M_pattern(pattern_test_white, 10, 70);   delay(10);    send_1M_pattern(pattern_test_white, 10, 70);   delay(10);   send_1M_pattern(pattern_test_white, 10, 70);   delay(10);    send_1M_pattern(pattern_test_white, 10, 70);   delay(10);   send_1M_pattern(pattern_test_white, 10, 70);   delay(10);   send_1M_pattern(pattern_test_white, 10, 70);   delay(10);   send_1M_pattern(pattern_test_white, 10, 70);   delay(10);   send_1M_pattern(pattern_test_white, 10, 70);   delay(10);     send_1M_pattern(pattern_test_white, 10, 70);   delay(10);   send_1M_pattern(pattern_test_white, 10, 70);   delay(10);   send_1M_pattern(pattern_test_white, 10, 70);   delay(10);   send_1M_pattern(pattern_test_white, 10, 70);   delay(10);   send_1M_pattern(pattern_test_white, 10, 70);   delay(10);   send_1M_pattern(pattern_test_white, 10, 70);   delay(10);   send_1M_pattern(pattern_test_white, 10, 70);   delay(10);   send_1M_pattern(pattern_test_white, 10, 70);   delay(10);   send_1M_pattern(pattern_test_white, 500, 0);   delay(4000);       while (1)   {     send_1M_pattern(pattern_test_rainbow, 10, 70);   }       /* frame++;     if(frame<=10) LEDSTRIP_PATTERN_0();     if(10     if(20     if(frame>30) frame=1;    */   //delay(1); } /******************************************************************************* * Function Name  : send_1M_pattern * Description    : Transmit pattern to whole 1 meter strip *                  * Input          : pointer to ROM pattern; pattern length; frame rate *                  * Output         : None * Return         : None *******************************************************************************/ void send_1M_pattern(const unsigned long data[][10], int pattern_no, int frame_rate) {   int i=0;   int j=0;   uint32_t temp_data;   for (i=0;i   {     noInterrupts();     for (j=0;j<10;j++)     {       temp_data=pgm_read_dword_near(&data;[i][j]);       send_strip(temp_data);     }     interrupts();     delay(frame_rate);   } } /******************************************************************************* * Function Name  : send_strip * Description    : Transmit 24 pulse to LED strip *                  * Input          : 24-bit data for the strip *                  * Output         : None * Return         : None *******************************************************************************/ void send_strip(uint32_t data) {   int i;   unsigned long j=0x800000;     for (i=0;i<24;i++)   {     if (data & j)     {       DATA_1;       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");          __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       /*----------------------------*/       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");        __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");        __asm__("nop\n\t");        __asm__("nop\n\t");        /*----------------------------*/            DATA_0;     }     else     {       DATA_1;       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");          DATA_0; /*----------------------------*/             __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");      /*----------------------------*/             }     j>>=1;   }   } /******************************************************************************* * Function Name  : reset_strip * Description    : Send reset pulse to reset all color of the strip *                  * Input          : None *                  * Output         : None * Return         : None *******************************************************************************/ void reset_strip() {   DATA_0;   delayMicroseconds(20); }

Question by ray33_ 5 years ago


RadioShack Tri Color LED strip light show help?

I'm having partial success creating a synchronized light show by calling some colors and adding delays. My main problem is creating specific colors or even displaying one color on the entire strip. Sorry that I put the whole code on here! I just got really stuck. Thank you in advance!! here's the default code for the strip for arduino: #include // ******** DEBUG ==== should auto config to adapt different mother board ********* //#define DATA_1 (PORTF |=  0X01)    // DATA 1    // for ATMEGA //#define DATA_0 (PORTF &=  0XFE)    // DATA 0    // for ATMEGA //#define STRIP_PINOUT DDRF=0xFF  // for ATMEGA #define DATA_1 (PORTC |=  0X01)    // DATA 1    // for UNO #define DATA_0 (PORTC &=  0XFE)    // DATA 0    // for UNO #define STRIP_PINOUT (DDRC=0xFF)    // for UNO PROGMEM const unsigned long pattern_test_red[10][10]={   {0xff0000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0xff0000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0xff0000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0xff0000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0xff0000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0xff0000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0xff0000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0xff0000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0xff0000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0xff0000}, }; PROGMEM const unsigned long pattern_test_blue[10][10]={   {0x00ff00,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x00ff00,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x00ff00,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x00ff00,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x00ff00,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x00ff00,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x00ff00,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x00ff00,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x00ff00,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x00ff00}, }; PROGMEM const unsigned long pattern_test_green[10][10]={   {0x0000ff,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x0000ff,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x0000ff,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x0000ff,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x0000ff,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x0000ff,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x0000ff,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x0000ff,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x0000ff,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x0000ff}, }; PROGMEM const unsigned long pattern_test_white[10][10]={   {0xffffff,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0xffffff,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0xffffff,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0xffffff,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0xffffff,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0xffffff,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0xffffff,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0xffffff,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0xffffff,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0xffffff}, }; PROGMEM const unsigned long pattern_test_comet1[][10]={   {0xffffff,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x444444,0xffffff,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x111111,0x444444,0xffffff,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x111111,0x444444,0xffffff}, }; PROGMEM const unsigned long pattern_test_comet2[][10]={   {0xffffff,0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000,0x000000,0x000000},   {0x444444,0xffffff,0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000,0x000000},   {0x111111,0x444444,0xffffff,0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000},   {0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000},   {0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000,0x111111,0x444444,0xffffff},   {0xffffff,0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000,0x000000,0x000000},   {0x444444,0xffffff,0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000,0x000000},   {0x111111,0x444444,0xffffff,0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000},   {0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000},   {0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000,0x111111,0x444444,0xffffff}, }; PROGMEM const unsigned long pattern_test_comet3[][10]={   {0xffffff,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0xffffff},   {0x444444,0xffffff,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0xffffff,0x444444},   {0x111111,0x444444,0xffffff,0x000000,0x000000,0x000000,0x000000,0xffffff,0x444444,0x111111},   {0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000,0xffffff,0x444444,0x111111,0x000000},   {0x000000,0x000000,0x111111,0x444444,0xffffff,0xffffff,0x444444,0x111111,0x000000,0x000000},   {0x000000,0x000000,0x111111,0x444444,0xffffff,0xffffff,0x444444,0x111111,0x000000,0x000000},   {0x000000,0x000000,0x000000,0xffffff,0x444444,0x444444,0xffffff,0x000000,0x000000,0x000000},   {0x000000,0x000000,0xffffff,0x444444,0x111111,0x111111,0x444444,0xffffff,0x000000,0x000000},   {0x000000,0xffffff,0x444444,0x111111,0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000},   {0xffffff,0x444444,0x111111,0x000000,0x000000,0x000000,0x000000,0x111111,0x444444,0xffffff}, }; PROGMEM const unsigned long pattern_test_rainbow[10][10]={   {0xff0000,0xff7f00,0xffff00,0x00ff00,0x0000ff,0x6f00ff,0x8f00ff,0x000000,0x000000,0x000000},   {0x000000,0xff0000,0xff7f00,0xffff00,0x00ff00,0x0000ff,0x6f00ff,0x8f00ff,0x000000,0x000000},   {0x000000,0x000000,0xff0000,0xff7f00,0xffff00,0x00ff00,0x0000ff,0x6f00ff,0x8f00ff,0x000000},   {0x000000,0x000000,0x000000,0xff0000,0xff7f00,0xffff00,0x00ff00,0x0000ff,0x6f00ff,0x8f00ff},   {0x8f00ff,0x000000,0x000000,0x000000,0xff0000,0xff7f00,0xffff00,0x00ff00,0x0000ff,0x6f00ff},   {0x6f00ff,0x8f00ff,0x000000,0x000000,0x000000,0xff0000,0xff7f00,0xffff00,0x00ff00,0x0000ff},   {0x0000ff,0x6f00ff,0x8f00ff,0x000000,0x000000,0x000000,0xff0000,0xff7f00,0xffff00,0x00ff00},   {0x00ff00,0x0000ff,0x6f00ff,0x8f00ff,0x000000,0x000000,0x000000,0xff0000,0xff7f00,0xffff00},   {0xffff00,0x00ff00,0x0000ff,0x6f00ff,0x8f00ff,0x000000,0x000000,0x000000,0xff0000,0xff7f00},   {0xff7f00,0xffff00,0x00ff00,0x0000ff,0x6f00ff,0x8f00ff,0x000000,0x000000,0x000000,0xff0000}, }; // *********************************************************************************************************** // * // *                            Power Up Init. // * // * // *********************************************************************************************************** void setup() {                 STRIP_PINOUT;        // set output pin - DEBUG: should auto detect which mother board for use   reset_strip();   //noInterrupts(); } // *********************************************************************************************************** // * // *                            Main Loop // * // * // *********************************************************************************************************** void loop() {   send_1M_pattern(pattern_test_red, 10, 500);   delay(500);   send_1M_pattern(pattern_test_blue, 10, 500);   delay(500);   send_1M_pattern(pattern_test_green, 10, 500);   delay(500);   send_1M_pattern(pattern_test_white, 10, 500);   delay(500);   send_1M_pattern(pattern_test_comet1, 10, 70);   delay(500);   send_1M_pattern(pattern_test_comet2, 10, 70);   delay(500);   send_1M_pattern(pattern_test_comet3, 10, 70);   delay(500);   while (1)   {     send_1M_pattern(pattern_test_rainbow, 10, 70);   }   /* frame++;     if(frame<=10) LEDSTRIP_PATTERN_0();     if(10     if(20     if(frame>30) frame=1;    */   //delay(1); } /******************************************************************************* * Function Name  : send_1M_pattern * Description    : Transmit pattern to whole 1 meter strip *                 * Input          : pointer to ROM pattern; pattern length; frame rate *                 * Output         : None * Return         : None *******************************************************************************/ void send_1M_pattern(const unsigned long data[][10], int pattern_no, int frame_rate) {   int i=0;   int j=0;   uint32_t temp_data;   for (i=0;i   {     noInterrupts();     for (j=0;j<10;j++)     {       temp_data=pgm_read_dword_near(&data;[i][j]);       send_strip(temp_data);     }     interrupts();     delay(frame_rate);   } } /******************************************************************************* * Function Name  : send_strip * Description    : Transmit 24 pulse to LED strip *                 * Input          : 24-bit data for the strip *                 * Output         : None * Return         : None *******************************************************************************/ void send_strip(uint32_t data) {   int i;   unsigned long j=0x800000;   for (i=0;i<24;i++)   {     if (data & j)     {       DATA_1;       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");         __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");      /*----------------------------*/       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       /*----------------------------*/           DATA_0;     }     else     {       DATA_1;       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");         DATA_0; /*----------------------------*/            __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");     /*----------------------------*/            }     j>>=1;   } } /******************************************************************************* * Function Name  : reset_strip * Description    : Send reset pulse to reset all color of the strip *                 * Input          : None *                 * Output         : None * Return         : None *******************************************************************************/ void reset_strip() {   DATA_0;   delayMicroseconds(20); } //***********AND HERE"S MY MODIFIED LIGHT SHOW CODE:*********** #include // ******** DEBUG ==== should auto config to adapt different mother board ********* //#define DATA_1 (PORTF |=  0X01)    // DATA 1    // for ATMEGA //#define DATA_0 (PORTF &=  0XFE)    // DATA 0    // for ATMEGA //#define STRIP_PINOUT DDRF=0xFF  // for ATMEGA #define DATA_1 (PORTC |=  0X01)    // DATA 1    // for UNO #define DATA_0 (PORTC &=  0XFE)    // DATA 0    // for UNO #define STRIP_PINOUT (DDRC=0xFF)    // for UNO PROGMEM const unsigned long pattern_test_red[10][10]={   {0xff0000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0xff0000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0xff0000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0xff0000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0xff0000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0xff0000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0xff0000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0xff0000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0xff0000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0xff0000}, }; PROGMEM const unsigned long pattern_test_blue[10][10]={   {0x00ff00,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x00ff00,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x00ff00,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x00ff00,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x00ff00,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x00ff00,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x00ff00,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x00ff00,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x00ff00,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x00ff00}, }; PROGMEM const unsigned long pattern_test_green[10][10]={   {0x0000ff,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x0000ff,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x0000ff,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x0000ff,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x0000ff,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x0000ff,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x0000ff,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x0000ff,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x0000ff,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x0000ff}, }; PROGMEM const unsigned long pattern_test_white[10][10]={   {0xffffff,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0xffffff,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0xffffff,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0xffffff,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0xffffff,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0xffffff,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0xffffff,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0xffffff,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0xffffff,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0xffffff}, }; PROGMEM const unsigned long pattern_test_comet1[][10]={   {0xffffff,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x444444,0xffffff,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x111111,0x444444,0xffffff,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x111111,0x444444,0xffffff}, }; PROGMEM const unsigned long pattern_test_comet2[][10]={   {0xffffff,0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000,0x000000,0x000000},   {0x444444,0xffffff,0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000,0x000000},   {0x111111,0x444444,0xffffff,0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000},   {0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000},   {0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000,0x111111,0x444444,0xffffff},   {0xffffff,0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000,0x000000,0x000000},   {0x444444,0xffffff,0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000,0x000000},   {0x111111,0x444444,0xffffff,0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000},   {0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000},   {0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000,0x111111,0x444444,0xffffff}, }; PROGMEM const unsigned long pattern_test_comet3[][10]={   {0xffffff,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0xffffff},   {0x444444,0xffffff,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0xffffff,0x444444},   {0x111111,0x444444,0xffffff,0x000000,0x000000,0x000000,0x000000,0xffffff,0x444444,0x111111},   {0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000,0xffffff,0x444444,0x111111,0x000000},   {0x000000,0x000000,0x111111,0x444444,0xffffff,0xffffff,0x444444,0x111111,0x000000,0x000000},   {0x000000,0x000000,0x111111,0x444444,0xffffff,0xffffff,0x444444,0x111111,0x000000,0x000000},   {0x000000,0x000000,0x000000,0xffffff,0x444444,0x444444,0xffffff,0x000000,0x000000,0x000000},   {0x000000,0x000000,0xffffff,0x444444,0x111111,0x111111,0x444444,0xffffff,0x000000,0x000000},   {0x000000,0xffffff,0x444444,0x111111,0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000},   {0xffffff,0x444444,0x111111,0x000000,0x000000,0x000000,0x000000,0x111111,0x444444,0xffffff}, }; PROGMEM const unsigned long pattern_test_rainbow[10][10]={   {0xff0000,0xff7f00,0xffff00,0x00ff00,0x0000ff,0x6f00ff,0x8f00ff,0x000000,0x000000,0x000000},   {0x000000,0xff0000,0xff7f00,0xffff00,0x00ff00,0x0000ff,0x6f00ff,0x8f00ff,0x000000,0x000000},   {0x000000,0x000000,0xff0000,0xff7f00,0xffff00,0x00ff00,0x0000ff,0x6f00ff,0x8f00ff,0x000000},   {0x000000,0x000000,0x000000,0xff0000,0xff7f00,0xffff00,0x00ff00,0x0000ff,0x6f00ff,0x8f00ff},   {0x8f00ff,0x000000,0x000000,0x000000,0xff0000,0xff7f00,0xffff00,0x00ff00,0x0000ff,0x6f00ff},   {0x6f00ff,0x8f00ff,0x000000,0x000000,0x000000,0xff0000,0xff7f00,0xffff00,0x00ff00,0x0000ff},   {0x0000ff,0x6f00ff,0x8f00ff,0x000000,0x000000,0x000000,0xff0000,0xff7f00,0xffff00,0x00ff00},   {0x00ff00,0x0000ff,0x6f00ff,0x8f00ff,0x000000,0x000000,0x000000,0xff0000,0xff7f00,0xffff00},   {0xffff00,0x00ff00,0x0000ff,0x6f00ff,0x8f00ff,0x000000,0x000000,0x000000,0xff0000,0xff7f00},   {0xff7f00,0xffff00,0x00ff00,0x0000ff,0x6f00ff,0x8f00ff,0x000000,0x000000,0x000000,0xff0000}, }; // *********************************************************************************************************** // * // *                            Power Up Init. // * // * // *********************************************************************************************************** void setup() {                 STRIP_PINOUT;        // set output pin - DEBUG: should auto detect which mother board for use   reset_strip();   //noInterrupts(); } // *********************************************************************************************************** // * // *                            Main Loop // * // * // *********************************************************************************************************** void loop() {   send_1M_pattern(pattern_test_white, 0, 0);   delay(36000);   send_1M_pattern(pattern_test_white, 500,0);   delay(5000);   send_1M_pattern(pattern_test_white, 10, 70);   delay(10);   send_1M_pattern(pattern_test_white, 10, 70);   delay(10);   send_1M_pattern(pattern_test_white, 10, 70);   delay(10);    send_1M_pattern(pattern_test_white, 10, 70);   delay(10);   send_1M_pattern(pattern_test_white, 10, 70);   delay(10);    send_1M_pattern(pattern_test_white, 10, 70);   delay(10);   send_1M_pattern(pattern_test_white, 10, 70);   delay(10);   send_1M_pattern(pattern_test_white, 10, 70);   delay(10);   send_1M_pattern(pattern_test_white, 10, 70);   delay(10);   send_1M_pattern(pattern_test_white, 10, 70);   delay(10);     send_1M_pattern(pattern_test_white, 10, 70);   delay(10);   send_1M_pattern(pattern_test_white, 10, 70);   delay(10);   send_1M_pattern(pattern_test_white, 10, 70);   delay(10);   send_1M_pattern(pattern_test_white, 10, 70);   delay(10);   send_1M_pattern(pattern_test_white, 10, 70);   delay(10);   send_1M_pattern(pattern_test_white, 10, 70);   delay(10);   send_1M_pattern(pattern_test_white, 10, 70);   delay(10);   send_1M_pattern(pattern_test_white, 10, 70);   delay(10);   send_1M_pattern(pattern_test_white, 500, 0);   delay(4000);      while (1)   {     send_1M_pattern(pattern_test_rainbow, 10, 70);   }   /* frame++;     if(frame<=10) LEDSTRIP_PATTERN_0();     if(10     if(20     if(frame>30) frame=1;    */   //delay(1); } /******************************************************************************* * Function Name  : send_1M_pattern * Description    : Transmit pattern to whole 1 meter strip *                 * Input          : pointer to ROM pattern; pattern length; frame rate *                 * Output         : None * Return         : None *******************************************************************************/ void send_1M_pattern(const unsigned long data[][10], int pattern_no, int frame_rate) {   int i=0;   int j=0;   uint32_t temp_data;   for (i=0;i   {     noInterrupts();     for (j=0;j<10;j++)     {       temp_data=pgm_read_dword_near(&data;[i][j]);       send_strip(temp_data);     }     interrupts();     delay(frame_rate);   } } /******************************************************************************* * Function Name  : send_strip * Description    : Transmit 24 pulse to LED strip *                 * Input          : 24-bit data for the strip *                 * Output         : None * Return         : None *******************************************************************************/ void send_strip(uint32_t data) {   int i;   unsigned long j=0x800000;   for (i=0;i<24;i++)   {     if (data & j)     {       DATA_1;       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");         __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");      /*----------------------------*/       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       /*----------------------------*/           DATA_0;     }     else     {       DATA_1;       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");         DATA_0; /*----------------------------*/            __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");     /*----------------------------*/            }     j>>=1;   } } /******************************************************************************* * Function Name  : reset_strip * Description    : Send reset pulse to reset all color of the strip *                 * Input          : None *                 * Output         : None * Return         : None *******************************************************************************/ void reset_strip() {   DATA_0;   delayMicroseconds(20); }

Topic by ray33_ 5 years ago  |  last reply 4 years ago


HELP! What is wrong with my Arduino Coding?!? Answered

I am attempting to use Arduino for the very first time. I have a small projector that I am trying to get the Arduino to automatically power up, and go through the menu settings (without human intervention).  I found the below coding online, and assuming it would be an easy copy paste..I bought all the supplies....yet...now when I try to use the Code- I keep getting errors. Help!! I know absolutly nothing about coding, or electronic programming...and I am stuck on this project for work! I keep getting errors about "ISO C++ forbids declaration of 'storecode' with no type at 54. What does this mean? THANK YOU SOOO MUCH FOR READING/TRYING. ---------------------------------------------------------------------------------------- /* * Beamer control (with LG LED beamer) * IRrecord: record and play back IR signals as a minimal * * IR LED connected to PIN 3 (AtmelATmega88 pin 5 */ #include int RECV_PIN = 11; int BUTTON_PIN = 12; int STATUS_PIN = 13; IRrecv irrecv(RECV_PIN); IRsend irsend; decode_results results; #define on 0x20DFB54A #define usb 0x20DF3EC1 #define ok 0x20DF22DD #define down 0x20DF827D #define left 0x20DF609F typedef struct { long time; long code; } remoteAction; remoteAction beamerShow[17]={ {5,on},{20,usb},{23,ok},{24,ok},{25,down}, {26,ok},{27,down},{28,ok},{29,ok},{30,ok}, {31,down},{32,ok},{33,left},{34,left},{35,left}, {26,ok},{1000,on}}; int pointer=0; void setup() { Serial.begin(9600); irrecv.enableIRIn(); // Start the receiver pinMode(BUTTON_PIN, INPUT); pinMode(STATUS_PIN, OUTPUT); } // Storage for the recorded code int codeType = -1; // The type of code unsigned long codeValue; // The code value if not raw unsigned int rawCodes[RAWBUF]; // The durations if raw int codeLen; // The length of the code int toggle = 0; // The RC5/6 toggle state // Stores the code for later playback // Most of this code is just logging void storeCode(decode_results *results) { codeType = results->decode_type; int count = results->rawlen; if (codeType == UNKNOWN) { Serial.println("Received unknown code, saving as raw"); codeLen = results->rawlen - 1; // To store raw codes: // Drop first value (gap) // Convert from ticks to microseconds // Tweak marks shorter, and spaces longer to cancel out IR receiver distortion for (int i = 1; i <= codeLen; i++) { if (i % 2) { // Mark rawCodes[i - 1] = results->rawbuf[i]*USECPERTICK - MARK_EXCESS; Serial.print(" m"); } else { // Space rawCodes[i - 1] = results->rawbuf[i]*USECPERTICK + MARK_EXCESS; Serial.print(" s"); } Serial.print(rawCodes[i - 1], DEC); } Serial.println(""); } else { if (codeType == NEC) { Serial.print("Received NEC: "); if (results->value == REPEAT) { // Don't record a NEC repeat value as that's useless. Serial.println("repeat; ignoring."); return; } } else if (codeType == SONY) { Serial.print("Received SONY: "); } else if (codeType == RC5) { Serial.print("Received RC5: "); } else if (codeType == RC6) { Serial.print("Received RC6: "); } else { Serial.print("Unexpected codeType "); Serial.print(codeType, DEC); Serial.println(""); } Serial.println(results->value, HEX); codeValue = results->value; codeLen = results->bits; } } void sendCode(int repeat) { if (codeType == NEC) { if (repeat) { irsend.sendNEC(REPEAT, codeLen); Serial.println("Sent NEC repeat"); } else { irsend.sendNEC(codeValue, codeLen); Serial.print("Sent NEC "); Serial.println(codeValue, HEX); } } else if (codeType == SONY) { irsend.sendSony(codeValue, codeLen); Serial.print("Sent Sony "); Serial.println(codeValue, HEX); } else if (codeType == RC5 || codeType == RC6) { if (!repeat) { // Flip the toggle bit for a new button press toggle = 1 - toggle; } // Put the toggle bit into the code to send codeValue = codeValue & ~(1 << (codeLen - 1)); codeValue = codeValue | (toggle << (codeLen - 1)); if (codeType == RC5) { Serial.print("Sent RC5 "); Serial.println(codeValue, HEX); irsend.sendRC5(codeValue, codeLen); } else { irsend.sendRC6(codeValue, codeLen); Serial.print("Sent RC6 "); Serial.println(codeValue, HEX); } } else if (codeType == UNKNOWN /* i.e. raw */) { // Assume 38 KHz irsend.sendRaw(rawCodes, codeLen, 38); Serial.println("Sent raw"); } } int lastButtonState; void loop() { long timer=millis()/1000; if (timer>beamerShow[pointer].time) { digitalWrite(STATUS_PIN, HIGH); irsend.sendNEC(beamerShow[pointer].code, 32); //on/off digitalWrite(STATUS_PIN, LOW); pointer++; } }

Question by techiekat 7 years ago  |  last reply 7 years ago


how to combine 2 Arduino codes together ?

Hello, I have a question. I need to combine my code for my Arduino project. I'm using a Arduino micro board .  The 2 codes are maxsonar and another is a flying drones coding. I'm lost and don't know how to combine the both of them as the maxsonar code will overwrite the flying drones code causing it unable to fly. Maxsonar code const int anPin1 = 0; const int anPin2 = 1; int triggerPin1 = 13; long distance1, distance2, cm1 ,cm2; void setup() {   Serial.begin(9600);  // sets the serial port to 9600   pinMode(triggerPin1, OUTPUT);   pinMode(A5, OUTPUT);   pinMode(A11, OUTPUT); } void start_sensor(){   digitalWrite(triggerPin1,HIGH);   delay(1);   digitalWrite(triggerPin1,LOW); } void Fading()//led1 { if (distance1 == 9) {    analogWrite(A5,25.5);     delay(10); } else if (distance1 == 8) {    analogWrite(A5,76.5);     delay(10); } else if( distance1 == 7) {    analogWrite(A5,153);     delay(10); } else if(distance1 == 6) {    analogWrite(A5,255);     delay(10); }   }   void Fading2()//led1 {   if (distance2 == 9) {    analogWrite(A11,25.5);     delay(10); } else if (distance2 == 8) {    analogWrite(A11,76.5);     delay(10); } else if( distance2 == 7) {    analogWrite(A11,153);     delay(10); } else if(distance2 == 6 ) {    analogWrite(A11,255);     delay(10); }   }   void read_sensors(){   /*   Scale factor is (Vcc/512) per inch. A 5V supply yields ~9.8mV/in   Arduino analog pin goes from 0 to 1024, so the value has to be divided by 2 to get the actual inches   */   distance1 = analogRead(anPin1)/2;   distance2 = analogRead(anPin2)/2; } void count_in_cm() {   cm1 = distance1 * 2.54;   cm2 = distance2 * 2.54; } void print_all() {     if( distance1 <10 && distance2 >=10 )   {   Fading();   analogWrite(A11,0);   Serial.print("Sensor1: Warning");   Serial.print(" ");   Serial.print(" ");   Serial.print("S2");   Serial.print(" ");   Serial.print(distance2);                                                                                                                                                                                                                                                                                                              Serial.print("in");   Serial.print(" ");   Serial.print(" ");   Serial.print(cm2);   Serial.print("cm");   Serial.println();   delay(700);     }   else if(distance1 >= 10 && distance2 < 10)   {   Fading2();   analogWrite(A5,0);   Serial.print("S1");   Serial.print(" ");   Serial.print(distance1);   Serial.print("in");   Serial.print(" ");   Serial.print(" ");   Serial.print(cm1);   Serial.print("cm");   Serial.print(" ");   Serial.print(" ");   Serial.print("Sensor2: Warning");   Serial.println();   delay(700);   }   else if (distance1 < 10 && distance2 < 10)   {     Fading();     Fading2();     Serial.print("Sensor1: Warning");     Serial.print("  ");     Serial.print("Sensor2: Warning");     Serial.println();     delay(700);      }   else   {   analogWrite(A11,0);   analogWrite(A5,0);   Serial.print("S1");   Serial.print(" ");   Serial.print(distance1);   Serial.print("in");   Serial.print(" ");   Serial.print(" ");   Serial.print(cm1);   Serial.print("cm");   Serial.print(" ");   Serial.print(" ");    Serial.print("S2");   Serial.print(" ");   Serial.print(distance2);   Serial.print("in");   Serial.print(" ");   Serial.print(" ");   Serial.print(cm2);   Serial.print("cm");   Serial.println();   delay(700);   } } void loop() {   start_sensor();   read_sensors();   count_in_cm();   print_all();   delay(200); //This is the equivant of the amount of sensors times 50.  If you changed this to 5 sensors the delay would be 250. } flying drone code #include #include // channel declaration Servo channel1; // throttle Servo channel2; // yaw Servo channel3; // pitch Servo channel4; // roll Servo channel5; // ball drop servo // PWM freq setting, should it be 62.33Hz? const int PWMConst = 20022;//50HZ // global variables byte incomingByte, incomingByteUSB; byte rcBuffer[32], usbBuffer[12]; int i = 0, j = 0, STATE = 1; int Flag = 0, usbFlag = 0; unsigned int thr_16int = 0, yaw_16int = 0, pit_16int = 0, rol_16int = 0, gear_16int = 0; unsigned int thr_16int_usb = 0, yaw_16int_usb = 0, pit_16int_usb = 0, rol_16int_usb = 0; float throttle = 1000, roll = 1500, pitch = 1500, yaw = 1500; int gear = 1500; float currT, prevT = 0, _flagHover, throFlag; // functions declaration void extract_RC_cmd(void); void extract_USB_cmd(void); void translate_RC_cmd(void); void translate_USB_cmd(void); void RC_Neutral(void); void reset_usb(void); void reset_rc(void); void hover(void); void sonar(void); void setup() {   // setting registers   TCCR1A = _BV(COM1A1) | _BV(COM1B1);   TCCR1B = _BV(WGM13) | _BV(CS11);   ICR1 = PWMConst;   // set PWM I/O ports   channel1.attach(6);    // throttle   channel2.attach(9);    // yaw   channel3.attach(5);    // pitch   channel4.attach(10);    // roll   channel5.attach(11);   // fail safe-attit   //init usb buffer   usbBuffer[0] = 0x03;   usbBuffer[1] = 0xE8;   usbBuffer[2] = 0x0D;   usbBuffer[3] = 0xAC;   usbBuffer[4] = 0x15;   usbBuffer[5] = 0x7C;   usbBuffer[6] = 0x1D;   usbBuffer[7] = 0x4C;   reset_rc();   reset_usb();   Serial1.begin(115200);   // rc Rx data in   Serial.begin(115200);     // USB } void loop() {   // accept serial data from computer   if (Serial.available() > 0)   {     incomingByteUSB = Serial.read();     if (incomingByteUSB >= 0x03 && incomingByteUSB <= 0x07)     {       usbFlag = 1;     }     if (usbFlag == 1)     {       usbBuffer[j] = incomingByteUSB;       j++;       if (j == 12)       {         usbFlag = 0;         j = 0;         extract_USB_cmd();       }     }   }   // accepte serial data from RC   if (Serial1.available() > 0)   {     incomingByte = Serial1.read();     if (incomingByte >= 0x80 && incomingByte <= 0x87)     {       Flag = 1;     }     if (Flag == 1)     {       rcBuffer[i] = incomingByte;       i++;       if (i == 32)       {         Flag = 0;         i = 0;         extract_RC_cmd();       }     }     // Serial.print(rcBuffer[i]);   }   // STATE MACHINE   switch (STATE)   {     case 1:       translate_USB_cmd();       reset_rc();       //Serial.print();       break;     case 2:       translate_RC_cmd();       reset_usb();       //Serial.print('R');       break;     case 3:       landing();       break;     default:       RC_Neutral();       break;   }     // output PWM   channel1.write(throttle);   channel2.write(yaw);   channel3.write(pitch);   channel4.write(roll);   channel5.write(gear); } // local functions void extract_RC_cmd() {   if (rcBuffer[0] >= 0x80 && rcBuffer[0] <= 0x87) // double check throttle range   {     thr_16int = rcBuffer[0] << 8 | rcBuffer[1]; // 16 bit throttle     // Serial.print(thr_16int);   }   if (rcBuffer[4] >= 0x19 && rcBuffer[4] <= 0x1E) // double check yaw range   {     yaw_16int = rcBuffer[4] << 8 | rcBuffer[5]; // 16 bit yaw     //Serial.print(yaw_16int);   }   if (rcBuffer[16] >= 0x09 && rcBuffer[16] <= 0x0E) // double check yaw range   {     rol_16int = rcBuffer[16] << 8 | rcBuffer[17]; // 16 bit yaw     //Serial.print(rol_16int);   }   if (rcBuffer[20] >= 0x11 && rcBuffer[20] <= 0x16) // double check yaw range   {     pit_16int = rcBuffer[20] << 8 | rcBuffer[21]; // 16 bit yaw     //Serial.print(pit_16int);   }   if (rcBuffer[22] >= 0x21 && rcBuffer[22] <= 0x26) // double check gear range   {     gear_16int = rcBuffer[22] << 8 | rcBuffer[23]; // 16 bit pitch     //Serial.print(pit_16int);   }   // state   if (rcBuffer[24] == 0x37 && rcBuffer[25] == 0xE0)    // Fmode SW state 1: Auto   {     STATE = 1;   }   else if (rcBuffer[24] == 0x34 && rcBuffer[25] == 0x00) // Fmode SW state 2: Manual   {     STATE = 2;   }   else if (rcBuffer[24] == 0x31 && rcBuffer[25] == 0xB4) // Fmode SW state 3: Emergency landing   {     STATE = 3;   } } void extract_USB_cmd(void) {   if (usbBuffer[0] >= 0x03 && usbBuffer[0] <= 0x07) // double check throttle range   {     thr_16int_usb = usbBuffer[0] << 8 | usbBuffer[1]; // 16 bit throttle   }   if (usbBuffer[2] >= 0x0B && usbBuffer[2] <= 0x0F) // double check yaw range   {     yaw_16int_usb = usbBuffer[2] << 8 | usbBuffer[3]; // 16 bit yaw   }   if (usbBuffer[4] >= 0x13 && usbBuffer[4] <= 0x17) // double check pit range   {     pit_16int_usb = usbBuffer[4] << 8 | usbBuffer[5]; // 16 bit pitch   }   if (usbBuffer[6] >= 0x1B && usbBuffer[6] <= 0x1F) // double check rol range   {     rol_16int_usb = usbBuffer[6] << 8 | usbBuffer[7]; // 16 bit role   }   // state   if (usbBuffer[10] == 0x2A && usbBuffer[11] == 0xF8)   {     //state = 1; // auto   }   else if (usbBuffer[10] == 0x2C && usbBuffer[11] == 0xEC)   {     STATE = 3; // emergency landing   }   else if (usbBuffer[10] == 0x2E && usbBuffer[11] == 0xE0)   {     STATE = 0; // default rc neutral   } } void translate_RC_cmd(void) {   throttle = (thr_16int - 30752 ) / 2.016;   yaw   = (9243 - yaw_16int) / 1.382;   pitch = (pit_16int - 3047) / 1.378;   roll  = (5129 - rol_16int) / 1.373;   gear  = (gear_16int - 7506) / 1.165;   throttle = min(2000, max(1000, throttle));   yaw      = min(2000, max(1000, yaw));   pitch    = min(2000, max(1000, pitch));   roll     = min(2000, max(1000, roll));   gear     = min(2000, max(1000, gear)); } void translate_USB_cmd(void) {   throttle = thr_16int_usb;   yaw = yaw_16int_usb - 2000;   pitch = pit_16int_usb - 4000;   roll =  rol_16int_usb - 6000;   //Serial.print(thr_16int_usb);   throttle = min(2000, max(1000, throttle));   yaw      = min(2000, max(1000, yaw));   pitch    = min(2000, max(1000, pitch));   roll     = min(2000, max(1000, roll)); } void RC_Neutral(void) {   throttle = 1000;   yaw = 1500;   pitch = 1500;   roll = 1500; } void landing(void) {   throttle = throttle - 1;   if (throttle <= 1000) throttle = 1000;   yaw = 1500;   pitch = 1500;   roll = 1500; } void reset_usb(void) {   thr_16int_usb = 1000;   yaw_16int_usb = 3500;   pit_16int_usb = 5500;   rol_16int_usb = 7500; } void reset_rc(void) {   thr_16int = 0x8000;   yaw_16int = 0x1C03;   pit_16int = 0x13FD;   rol_16int = 0x0C07; }

Topic by singno123 3 years ago  |  last reply 11 months ago


Problem in arduino code... you'll have to run this one to understand - Word Clock? Answered

I have been writing this code for the Word clock. I am trying to customize the code to fit into an atmega8, and use DS1307 RTC. Both of these is fine, but what is wrong is that when I upload my code and try to set the time by using the buttons, the time is not setting properly. I can increment minutes with the minutes button to 16, but not further. Hours works fine, but if, lets say the time is 6:36 on the arduino, then If I press the hour button, I find that time changes to 7:31. Five minutes less than what I expected. What am I overlooking here?  I advise to run the code and understand the problem. On the other hand Binary sketch size: 7164 bytes (of a 7168 byte maximum), this is just 4 bytes short of max. Can that be a part of the problem Code: #include // Display output pin assignments #define MTEN  Display1=Display1 | (1<<0)  #define HALF Display1=Display1 | (1<<1) #define QUARTER Display1=Display1 | (1<<2) #define TWENTY Display1=Display1 | (1<<3) #define MFIVE Display1=Display1 | (1<<4) #define MINUTES Display1=Display1 | (1<<5) #define PAST Display1=Display1 | (1<<6) #define UNUSED1 Display1=Display1 | (1<<7) #define TO Display2=Display2 | (1<<0) #define ONE Display2=Display2 | (1<<1) #define TWO Display2=Display2 | (1<<2) #define THREE Display2=Display2 | (1<<3) #define FOUR Display2=Display2 | (1<<4) #define HFIVE Display2=Display2 | (1<<5) #define SIX Display2=Display2 | (1<<6) #define UNUSED2 Display2=Display2 | (1<<7) #define SEVEN Display3=Display3 | (1<<0) #define EIGHT Display3=Display3 | (1<<1) #define NINE Display3=Display3 | (1<<2) #define HTEN Display3=Display3 | (1<<3) #define ELEVEN Display3=Display3 | (1<<4) #define TWELVE Display3=Display3 | (1<<5) #define OCLOCK  Display3=Display3 | (1<<6) #define UNUSED3 Display3=Display3 | (1<<7) #define DS1307_I2C_ADDRESS 0x68  // This is the I2C address #if defined(ARDUINO) && ARDUINO >= 100   // Arduino v1.0 and newer   #define I2C_WRITE Wire.write   #define I2C_READ Wire.read #else                                   // Arduino Prior to v1.0   #define I2C_WRITE Wire.send   #define I2C_READ Wire.receive #endif int  hr=12, mn=00, scnd=0; static unsigned long msTick =0;  // the number of Millisecond Ticks since we last                                  // incremented the second counter int  count; boolean selftestmode; boolean  DS1307Present=false;       // flag to indicate that the 1307 is there..    1 = present char Display1=0, Display2=0, Display3=0; // hardware constants static unsigned int LEDClockPin=5;    //11 d5 ok static unsigned int LEDDataPin=3;    //5 d3 static unsigned int LEDStrobePin=4;   //6 d4 static unsigned int MinuteButtonPin=6;  //d6 12 static unsigned int HourButtonPin=7;    //d7 13 static unsigned int PWMPin = 11; char buf[50]; // time output string for debugging byte decToBcd(byte b) {  return ( ((b/10) << 4) + (b%10) );} // Convert binary coded decimal to normal decimal numbers byte bcdToDec(byte b) {  return ( ((b >> 4)*10) + (b%16) );} void getTime() {   //read from chip and store in hr, mn, scnd   Wire.beginTransmission(DS1307_I2C_ADDRESS);   I2C_WRITE((uint8_t) 0x00);   Wire.endTransmission();     Wire.requestFrom(DS1307_I2C_ADDRESS, 3);   scnd = bcdToDec(I2C_READ());   mn =  bcdToDec(I2C_READ());   hr =  bcdToDec(I2C_READ()); } void setTime() {   //to be paranoid, we're going to first stop the clock   //to ensure we don't have rollovers while we're   //writing:   writeRTCreg(0,0x80);   //now, we'll write everything *except* the second   Wire.beginTransmission(DS1307_I2C_ADDRESS);   I2C_WRITE((uint8_t) 0x01);   I2C_WRITE(mn);   I2C_WRITE(hr);   Wire.endTransmission();   //now, we'll write the seconds; we didn't have to keep   //track of whether the clock was already running, because   //scnd already knows what we want it to be. This   //will restart the clock as it writes the new seconds value.   writeRTCreg(0,scnd); } byte readRTCreg(byte adr) {    if(adr > 0x3F) { return 0xff; }   Wire.beginTransmission(DS1307_I2C_ADDRESS);   I2C_WRITE(adr);   Wire.endTransmission();   Wire.requestFrom(DS1307_I2C_ADDRESS, 1);   return I2C_READ(); } void writeRTCreg(byte adr, byte val) { if(adr > 0x3F) { return; }    Wire.beginTransmission(DS1307_I2C_ADDRESS);    I2C_WRITE(adr);    I2C_WRITE(val);    Wire.endTransmission(); } void print_DS1307time() {   /* Format the time and date and insert into the temporary buffer */   snprintf(buf, sizeof(buf), "RTC time: %02d:%02d:%02d",   hr, mn, scnd);   /* Print the formatted string to serial so we can see the time */   Serial.println(buf); } void setup() {   // initialise the hardware   // initialize the appropriate pins as outputs:   pinMode(LEDClockPin, OUTPUT);   pinMode(LEDDataPin, OUTPUT);   pinMode(LEDStrobePin, OUTPUT);       //pinMode(BrightnessPin, INPUT);   pinMode(MinuteButtonPin, INPUT);   pinMode(HourButtonPin, INPUT);   digitalWrite(MinuteButtonPin, HIGH);  //set internal pullup   digitalWrite(HourButtonPin, HIGH); //set internal pullup   pinMode(PWMPin, OUTPUT);     Serial.begin(9600);   Wire.begin();    // test whether the DS1302 is there   Serial.print("Verifying DS1307 ");   // start by verifying that the chip has a valid signature   if (readRTCreg(0x20) == 0x55) {     // Signature is there - set the present flag and mmove on     DS1307Present=true;     Serial.println("Valid Signature");   }   else   {     // Signature isnt there - may be a new chip -     //   do a write to see if it will hold the signature     writeRTCreg(0x20,0x55);     if (readRTCreg(0x20) == 0x55) {       // We can store data - assume that it is a new chip that needs initialisation /*      // Start by clearing the clock halt flag.           //"Bit 7 of register 0 is the clock halt (CH) bit.           //When this bit is set to a 1, the oscillator is disabled."             byte _reg0_sec = decToBcd(scnd);             _reg0_sec = _reg0_sec & ~0x80;             writeRTCreg(0,_reg0_sec); */       // Set the time and date on the chip       scnd = 0;       mn = 0;       hr = 12;       setTime();       // set the DS1302 present flag       DS1307Present=true;       Serial.println("present - new chip initialised.");     }     else  Serial.println("absent");   }    msTick=millis();      // Initialise the msTick counter     selftest();   selftestmode=false;   if (DS1307Present) {     // Get the current time and date from the chip    getTime();     }     displaytime();        // display the current time } void ledsoff(void) { Display1=0; Display2=0; Display3=0; } void WriteLEDs(void) { // Now we write the actual values to the hardware shiftOut(LEDDataPin, LEDClockPin, MSBFIRST, Display3); shiftOut(LEDDataPin, LEDClockPin, MSBFIRST, Display2); shiftOut(LEDDataPin, LEDClockPin, MSBFIRST, Display1); digitalWrite(LEDStrobePin,HIGH); delay(2); digitalWrite(LEDStrobePin,LOW); } void selftest(void){   Serial.print("TEST");   analogWrite(PWMPin, 255);     ledsoff(); MTEN; WriteLEDs(); delay(500);   ledsoff(); HALF; WriteLEDs(); delay(500);   ledsoff(); QUARTER; WriteLEDs(); delay(500);   ledsoff(); TWENTY; WriteLEDs(); delay(500);   ledsoff(); MFIVE; WriteLEDs(); delay(500);   ledsoff(); MINUTES; WriteLEDs(); delay(500);   ledsoff(); PAST; WriteLEDs(); delay(500);   ledsoff(); TO; WriteLEDs(); delay(500);   ledsoff(); ONE; WriteLEDs(); delay(500);   ledsoff(); TWO; WriteLEDs(); delay(500);   ledsoff(); THREE; WriteLEDs(); delay(500);   ledsoff(); FOUR; WriteLEDs(); delay(500);   ledsoff(); HFIVE; WriteLEDs(); delay(500);   ledsoff(); SIX; WriteLEDs(); delay(500);   ledsoff(); SEVEN; WriteLEDs(); delay(500);   ledsoff(); EIGHT; WriteLEDs(); delay(500);   ledsoff(); NINE; WriteLEDs(); delay(500);   ledsoff(); HTEN; WriteLEDs(); delay(500);   ledsoff(); ELEVEN; WriteLEDs(); delay(500);   ledsoff(); TWELVE; WriteLEDs(); delay(500);   ledsoff(); OCLOCK; WriteLEDs(); delay(500); } void displaytime(void){   // start by clearing the display to a known state   ledsoff();     Serial.print("It is ");   // now we display the appropriate minute counter   if ((mn>4) && (mn<10)) {     MFIVE;     MINUTES;     Serial.print("Five Minutes ");   }   if ((mn>9) && (mn<15)) {     MTEN;     MINUTES;     Serial.print("Ten Minutes ");   }   if ((mn>14) && (mn<20)) {     QUARTER;       Serial.print("Quarter ");   }   if ((mn>19) && (mn<25)) {     TWENTY;     MINUTES;     Serial.print("Twenty Minutes ");   }   if ((mn>24) && (mn<30)) {     TWENTY;     MFIVE;     MINUTES;     Serial.print("Twenty Five Minutes ");   }    if ((mn>29) && (mn<35)) {     HALF;     Serial.print("Half ");   }   if ((mn>34) && (mn<40)) {     TWENTY;     MFIVE;     MINUTES;     Serial.print("Twenty Five Minutes ");   }    if ((mn>39) && (mn<45)) {     TWENTY;     MINUTES;     Serial.print("Twenty Minutes ");   }   if ((mn>44) && (mn<50)) {     QUARTER;     Serial.print("Quarter ");   }   if ((mn>49) && (mn<55)) {     MTEN;     MINUTES;     Serial.print("Ten Minutes ");   }   if (mn>54) {     MFIVE;     MINUTES;     Serial.print("Five Minutes ");   }   if ((mn <5))   {     switch (hr) {     case 1:       ONE;       Serial.print("One ");       break;     case 2:       TWO;       Serial.print("Two ");       break;     case 3:       THREE;       Serial.print("Three ");       break;     case 4:       FOUR;       Serial.print("Four ");       break;     case 5:       HFIVE;       Serial.print("Five ");       break;     case 6:       SIX;       Serial.print("Six ");       break;     case 7:       SEVEN;       Serial.print("Seven ");       break;     case 8:       EIGHT;       Serial.print("Eight ");       break;     case 9:       NINE;       Serial.print("Nine ");       break;     case 10:       HTEN;       Serial.print("Ten ");       break;     case 11:       ELEVEN;       Serial.print("Eleven ");       break;     case 12:       TWELVE;       Serial.print("Twelve ");       break;     }   OCLOCK;   Serial.println("O'Clock");   }   else     if ((mn < 35) && (mn >4))     {       PAST;       Serial.print("Past ");       switch (hr) {     case 1:       ONE;       Serial.println("One ");       break;     case 2:       TWO;       Serial.println("Two ");       break;     case 3:       THREE;       Serial.println("Three ");       break;     case 4:       FOUR;       Serial.println("Four ");       break;     case 5:       HFIVE;       Serial.println("Five ");       break;     case 6:       SIX;       Serial.println("Six ");       break;     case 7:       SEVEN;       Serial.println("Seven ");       break;     case 8:       EIGHT;       Serial.println("Eight ");       break;     case 9:       NINE;       Serial.println("Nine ");       break;     case 10:       HTEN;       Serial.println("Ten ");       break;     case 11:       ELEVEN;       Serial.println("Eleven ");       break;     case 12:       TWELVE;       Serial.println("Twelve ");       break;       }     }     else     {       // if we are greater than 34 minutes past the hour then display       // the next hour, as we will be displaying a 'to' sign       TO;       Serial.print("To ");       switch (hr) {       case 1:         TWO;        Serial.println("Two ");        break;       case 2:         THREE;       Serial.println("Three ");         break;       case 3:         FOUR;       Serial.println("Four ");         break;       case 4:         HFIVE;       Serial.println("Five ");         break;       case 5:         SIX;       Serial.println("Six ");         break;       case 6:         SEVEN;       Serial.println("Seven ");         break;       case 7:         EIGHT;       Serial.println("Eight ");         break;       case 8:         NINE;       Serial.println("Nine ");         break;       case 9:         HTEN;       Serial.println("Ten ");         break;       case 10:         ELEVEN;       Serial.println("Eleven ");         break;       case 11:         TWELVE;       Serial.println("Twelve ");         break;       case 12:         ONE;       Serial.println("One ");         break;       }     }    WriteLEDs();    } void incrementtime(void){   // increment the time counters keeping care to rollover as required   scnd=0;   if (++mn >= 60) {     mn=0;     if (++hr == 13) {       hr=1;      }   }    // debug outputs   Serial.println(); //  if (DS1307Present) //  print_DS1307time(); //  else{ //  Serial.print("Arduino Time: " );   Serial.print(hr);   Serial.print(":");   Serial.print(mn);   Serial.print(":");   Serial.println(scnd); //  } } void loop(void) {     //selftest(); int aread = sq(analogRead(3)/4)+3;   //Uncomment the following line and comment the next one in order to   //  enable dimming via a potentiometer connected to pin 0:   analogWrite(PWMPin, aread>255 ? 255:aread);   //analogWrite(PWMPin, 255);       // heart of the timer - keep looking at the millisecond timer on the Arduino     // and increment the seconds counter every 1000 ms     if ( millis() - msTick >999) {         msTick=millis();         scnd++; /*        // Flash the onboard Pin13 Led so we know something is hapening!         digitalWrite(13,HIGH);         delay(100);         digitalWrite(13,LOW);    */    }                 //test to see if we need to increment the time counters     if (scnd==60)     {       incrementtime();       displaytime();     } if (DS1307Present) {     // Get the current time and date from the chip      getTime();     }     // test to see if a forward button is being held down     // for time setting     if ( (digitalRead(MinuteButtonPin) ==0 ) && scnd!=1)       // the forward button is down       // and it has been more than one second since we       // last looked     {       mn=(((mn/5)*5) +5);       scnd=0;       incrementtime();       scnd++;  // Increment the second counter to ensure that the name       // flash doesnt happen when setting time       if (DS1307Present) {       // Set the time on the chip       setTime();     }     delay(100);       displaytime();     }     // test to see if the back button is being held down     // for time setting     if ((digitalRead(HourButtonPin)==0 ) && scnd!=1)     {       /*       minute=(((minute/5)*5) -5);       second=0; // decrement the minute counter       if (minute<0) {         minute=55;         if (--hour <0) hour=12;       }       */             mn = (mn/5)*5;  //round minute down to previous 5 min interval       if (++hr == 13) {         hr=1;        }       incrementtime();       scnd++;  // Increment the second counter to ensure that the name       // flash doesnt happen when setting time        if (DS1307Present) {       // Set the time and date on the chip       setTime();     }     delay(100);       displaytime();     } }

Question by pro2xy 7 years ago  |  last reply 7 years ago


unfinished,5 DOF Robotic Mechanical ARM

5 DOF Robotic Mechanical ARM Required Material of project:- 1. Basic Servo Tower pro 9g*4 2. Header pins Male female*2 3. Arduino Nano*1 4.10kΩ Resistor resistance*2 5. Trimmer Potentiometer track Linear; maximum resistance 10kΩ*4 6. Tactile push button*2 7. Blank circuit board*1 8. Acrylic strips for Robot & potentiometer body*2 9. Wires, Button, Switch 10.Balsa wood, Metal, Plastic Procedure:- Arrange all necessary items.. Please go through the attached images  for better understanding.. I divide whole project in two parts 1) Servo Motor assembly 2) Potentiometer assembly 1) Servo motor assembly: – Servo motor as J1, J2, J3, J4 fix the servo motors as shown in image use 3M tape to glue servo, use thin flexible plastic strip to make griper, make hole in center of each finger tie thread in that hole pass this thread from center hole and tie knot at the other end of thread with 4th servo motor’s knob, as you stretch thread finger get close vise versa. Fix whole arrangement on strong rigid base. 2) Potentiometer assembly: – Fix potentiometer as shown in figure name potentiometer as do previous R3, R4, R5, R6 this time place R6 separately for easy access this potentiometer control gripper to pick and place. Potentiometer arrangement symmetry must be same as servo arm. Fix whole arrangement on strong rigid base. Moving a little bolt from one side to the other side:- 1. Actuators / output devices: 4 micro servos 2. Control method: controlled by a PIC16F690       assembler firmware 3. CPU: PIC16f690 micro controller 4. Operating system: self made assembler code 5. Power source: 4.8V to 6V from 4 battery cells 6. Programming language: PIC Assembler 7. Sensors / input devices: teach in system with                         4 potentiometers       Making Processer:- The Potis are standard types and are screwed to the white plastic parts with their nuts. The axles are pressed into the transparent plastic part. The handle to move the teach-in-arm is a M3-Spacer and the socket is a plastic part with is normally used to fix balloons on a stick to hold it.                     move the motor itself by hand a little force is needed due to its permanent magnets, which create a small holding force. But inside the servo a lot of gears increase the force which you have to apply. If you move the servo by hand, you have to apply a much higher force. If you overcome the motors holding force, it starts to rotate an acts as a flywheel. So moving a servo by hand needs a high torque and its not easy to turn it to the position where you want it. ( Fan control modules for engine cooling of real cars have some extra parts to clamp the voltage which is generated, when you drive at higher speeds. In that case the fan works like a windmill and creates higher voltages than normal inside the power stage of the module.) And there were also a lot of other "problems" which had to be solved using my PIC Controllers. i.e. self made electronics for a RC-Excavator which works similar to the digital system used in slot cars. To replace a lot of wires between the rotating part of the excavator and the track unit, a small PIC 12F629 reads the pulses from up to 5 channels of a RC-Receiver and leads their information via a 2 wire connection to a second PIC12F629. At the second board the power is separated from the data. The PIC is reading the data, and generates the PWM output for the 5 Servo output connector. the 2 wire connection is made with a cheap 6,3mm mono microphone plug which is also used as the axle for the rotating part. The arm of the excavator is also powered by standard servos and so it was necessary to change the control behavior from proportional to integral so that the servos move like real hydraulic cylinders which are controlled by valves. I used the same 12F629 type for that job and added some features like adjustable limit positions and starting point programmable by one jumper, and automatic return to park position when missing the pulses for some seconds. The Software is simple:- Its working like a servotester for four axis. That means, every poti is connected to an analog in of the controller and all servos are connected to GPIOs. The controller reads each poti, does some scaling, so that the angle of the poti equals to the angle of the axis and finally he creates the PWM output 1-2ms pulse every 20ms for all servos. Teach mode:- After a reset the robot arm follows the teach in arm while simple mapping the analog inputs every 25ms to the servo motors. Pressing the button stores each servo position in a array. Play mode: The sketch reads the array step by step and moves the robot arm. For cool looking movements I added a routine calculates different micro steps for each servo to have moving start and end sync on all axis. Also added a ramp for soft increase/decrease velocity. Shorter travel distances the robot does slow, longer distances with faster speed.           The program moves the servos at full speed to the next position and a short delay time after each command allows all of the servos to reach their final position. That means that it is possible to increase the speed a little bit more by doing some fine tuning of the delay times after each command. The final thing which is still not implemented is the routine which saves the "Teach In" data 5 or 10 times per second, so that the controller is able to replay it in a loop with the original speed or with a lower or higher speed. Electrical Connection:- Provide separate power supply (5V DC 1amps) to the Servo motors . Don’t forget to short ground of both power source ( arduino + servo) 5 DOF Robotic Mechanical ARM :- 1. Use of Fiber on upper side 2. wooden spoon is a part of side body 3. cable tie *12 pieces use the robotic. 4. Some pices of wires 5. use scraw*4 6. Glue 7. some small clips Because to attached body 8. small size of plastic box 9. One pieces of  square fiber stand and one pieces small & medium  circular fiber  10.  L293D Motor Driver IC+IC Base KG143 11. Generic Elementz High Quality Nickel Plated 24*18 Points Bread Board*(2 pieces) and one plastic 12. Push Button Switch. Play Mode version 1.1 The gripper input is used to set the delay (0,1,3,15,60,300 seconds) after a loop is done. The switch (it was left from the project start) pauses the robot.        Thanks you:

Topic by aarif1234 1 year ago


500W electric scooter control and instrumentation with Arduino mega

1. Introduction DC 500W motor control with an Arduino mega to limit starting current and to vary the speed of the scooter. The battery is in 24V, 10A.h. The following table summarizes their characteristics: https://i58.servimg.com/u/f58/17/56/35/17/a014.jpg https://i58.servimg.com/u/f58/17/56/35/17/a111.jpg 2. Bibliography: Link download : sketch_escooter_feed_back_reel_V1.ino https://drive.google.com/file/d/0B_fB3GAsM02FSlRTWHdyRkhuUW8/view?usp=sharing escooter_ampli_SIMULINK.mdl https://drive.google.com/file/d/0B_fB3GAsM02FOW9OdmlhdDhJZGc/view?usp=sharing escooter feed back ISIS.DSN https://drive.google.com/file/d/0B_fB3GAsM02FOXdRWFN5OWRMQkE/view?usp=sharing youtube  :  "study trotinette electric e-scooter 100W et 350W, wiring"  youtube https://www.youtube.com/watch?v=QqJ2-YiE8Tg&index;=75&list;=PLfZunVn_gcq7EOurXuWU2sRFmh6CbiUiL Article: «Study of electric scooters 100W and 500W (Arduino), Revue 3EI 2017» Pdf? Book «I realize my electric vehicle» at DUNOD 3. Open loop program To test the programming, we simulate the program in ISIS, as can be seen in the following figure. In addition, we have an LCD display to display data (duty cycle corresponding to the PWM at 32Khz, motor current, motor voltage, action on the pushbuttons, 4 push buttons are used. BP1 to manually increment the duty cycle, BP2 decrement it. BP3 set the duty cycle to 0, corresponding to the brake contact. The speed of the motor is practically proportional to the duty cycle https://i58.servimg.com/u/f58/17/56/35/17/a211.jpg We made our own current amplifier called a step-down chopper but it is possible to buy a shield There are many cards for Arduino to control DC motors especially of low powers and also of great powers as can be observed on the following links.http://www.robotpower.com/products/MegaMotoPlus_info.html http://www.robotshop.com/en/dc-motor-driver-2-15a.html https://www.pololu.com/file/0J51/vnh3sp30.pdf https://i58.servimg.com/u/f58/17/56/35/17/a310.jpg But all these chopper shields measure the current internally but there is no current limitation. In order to have a current limitation, an analog current loop is required using specialized AOP or IC or a fast digital current loop. But what should be the value of the limitation current? The choice of the current value is normally for the 1-hour operation service in order to be able to carry out relatively long climbs without reaching the critical temperature of the engine. In our case, the limitation current must be Limiting motor = Power / Upper battery = 500W / 24V = 20A In addition, the power transistor of the chopper can only support 50A in our case. But in open loop, it has no current regulation, so as not to exceed the maximum current, a ramp of the duty cycle will be used. A 0.1 second interruption routine will be used to measure the voltage of the current (sample measurement, sample). This sampling time is arbitrary but does not allow to be faster than the rise time of the current because the electric time constant of the motor is L / R = 1.5 ms. Open loop operation with a 25.5s (8bit) ramp and 0.1s interrupt routine provides a good understanding of the operation of a DC motor drive. The display will only be done every 0.2s to have a stability of the digits on the screen. In addition, a digital filtering will be done on the current and the voltage on 4 values therefore on 0.4s. [b] Algo open loop [/b] Interrupt Routine All 0.1S Read voltage and current Loop loop (push button scan) If BP1 = 1 then increment PWM If BP2 = 1 then decrement PWM If BP3 = 1 then PWM = 0 Displaying variables every 0.2s Code: [Select] // include the library code: #include #include #include #define SERIAL_PORT_LOG_ENABLE 1 #define Led     13       // 13 for the yellow led on the map #define BP1     30       // 30 BP1 #define BP2     31       // 31 BP2           #define BP3     32       // 32 BP3 #define LEDV    33       // 33 led #define LEDJ    34       // 34 led #define LEDR    35       // 35 led #define relay   36       // 36 relay #define PWM10    10      //11   timer2    LiquidCrystal lcd(27, 28, 25, 24, 23, 22); // RS=12, Enable=11, D4=5, D5=4, D6= 3, D7=2, BPpoussoir=26 // Configuring variables unsigned   int UmoteurF = 0;  // variable to store the value coming from the sensor unsigned   int Umoteur = 0; unsigned   int Umoteur2 = 0; unsigned   int Umoteur3 = 0; unsigned   int Umoteur4 = 0; unsigned   int ImoteurF = 0;  unsigned   int Imoteur = 0; unsigned   int Imoteur2 = 0; unsigned   int Imoteur3 = 0; unsigned   int Imoteur4 = 0;            byte Rcy=0 ;    // 8bit duty cycle unsigned    int temps; // the setup function runs once when you press reset or power the board void setup() {   pinMode(Led, OUTPUT);   // Arduino card   pinMode(LEDV, OUTPUT);   pinMode(LEDR, OUTPUT);   pinMode(LEDJ, OUTPUT);   pinMode (PWM10,OUTPUT);     // Pin (10) output timer2   //  digitalWrite(LEDV,LOW);   Timer1.initialize(100000);         // initialize timer1, and set a 0,1 second period =>  100 000   Timer1.attachInterrupt(callback);  // attaches callback() as a timer overflow interrupt   lcd.begin(20, 4);    Serial1.begin(9600);   TCCR2B = (TCCR2B & 0b11111000) | 0x01;         //pin 10  32khz    http://playground.arduino.cc/Main/TimerPWMCheatsheet                                                   //http://www.pobot.org/Modifier-la-frequence-d-un-PWM.html   //   analogWriteResolution(bits)      https://www.arduino.cc/en/Reference/AnalogWriteResolution lcd.setCursor(0,1); lcd.print("Rcy"); lcd.setCursor(10,1); lcd.print("Um"); lcd.setCursor(5,1); lcd.print("Im"); lcd.setCursor(10,1); lcd.print("Um"); lcd.setCursor(20,1); // 4 lines display * 20 characters lcd.print("BP1+"); lcd.setCursor(25,1); lcd.print("BP2-"); lcd.setCursor(29,1); lcd.print("BP3=0"); } // Interruptions  tous les 0.1s void callback()  { temps++; //toogle state ledv for check   if ( digitalRead(LEDV)== 1 ) {digitalWrite(LEDV,LOW);}     else {digitalWrite(LEDV,HIGH);}     analogWrite(PWM10,Rcy);   // frequency Umoteur=analogRead(A0); Imoteur=analogRead(A1); Imoteur2=Imoteur; Imoteur3=Imoteur2; Imoteur4=Imoteur3; ImoteurF=(Imoteur4+Imoteur3+Imoteur2+Imoteur)/4 ; Umoteur2=Umoteur; Umoteur3=Umoteur2; Umoteur4=Umoteur3; UmoteurF=(Umoteur4+Umoteur3+Umoteur2+Umoteur)/4 ;   }// End routine // Loop corresponding to main function void loop() {    // BP + LED   if ((digitalRead(BP1))==1) {     lcd.setCursor(20,0);      // Column line     lcd.print("BP1");     digitalWrite(LEDR, LOW);        digitalWrite(LEDJ, LOW);     Rcy++;                        // PWM incrementation     if ( Rcy>254)  {Rcy=254;}     delay(100);               //8bits * 100ms = 25S increment 25ssecond slope     }        if ((digitalRead(BP2))==1) {     lcd.setCursor(20,0);     lcd.print("BP2");             Rcy--;      if ( Rcy<2)  {Rcy=2;}  // PWM almost at 0, engine stop         delay(100);      digitalWrite(LEDR, HIGH);     digitalWrite(LEDJ, HIGH);     }   if ((digitalRead(BP3))==1) {     lcd.setCursor(20,0);     lcd.print("BP3");      Rcy=2;               // PWM almost at 0, engine stop     } if (temps>=2)  { lcd.setCursor(0,0); lcd.print("                "); // Erase line lcd.setCursor(0,0);     lcd.print(Rcy); lcd.setCursor(5,0); ImoteurF=(ImoteurF)/20;     //resistance (5/1024)*(10/0.25ohm) si ACS712 66mV/A                            // For resistance 1ohm (ImoteurF) / 20; Simulation 5/25 lcd.print(ImoteurF); lcd.setCursor(10,0); UmoteurF=UmoteurF*10/38;                              //10/38   10/30 simula if (Umoteur>ImoteurF){UmoteurF=UmoteurF-ImoteurF;  }  //U-R*I lcd.print(UmoteurF); temps=0; }// End if time    } // End loop https://i58.servimg.com/u/f58/17/56/35/17/dsc_0614.jpg Since there is a limit of 9000 characters in the forum below Open loop program feature previous The interrupt routine lasts only 250 microseconds, the loop of the main program which scans the action of push buttons is 13micros and the display time of all data is 11ms. Thus, it is possible to improve the sampling period and thus the speed of the regulation of the current. The Arduino makes it possible to make the instrumentation of the scooter so to know the power, the consumption in Ah and Wh, to measure the speed, to know the consumption according to Wh / km, to measure the temperature of the engine, Have a safe operation. But for now we will see how to limit the current 4. Closed loop program, limited current control The sampling period will increase to 0.01 seconds (interrupt routine) If the current is less than the desired value, then the duty cycle can be increased or decreased to the desired value which is the setpoint. On the other hand, if the motor current is greater than the limiting value, there is a rapid decrease in the duty cycle. So as not to exceed the value of the duty cycle if it is saturated to 254 maximum and to the minimum value 6. Code: [Select] if (Imoteur<4000)                    // No current limitation at (20A * 10) * 20 = 4000   {if (consigne>Rcy)   {Rcy=Rcy+1;}   // Pwm ramp + 1 * 0.01second pure integrator    if (consigne    if ( Rcy>254)  {Rcy=254;}           // Limitation of duty cycle    analogWrite(PWM10,Rcy);   // Frequency 32kHz timer2}         } if (Imoteur>4000)  { Rcy=Rcy-5;              // No current filtering, to be faster                     if ( Rcy<6)  {Rcy=5;}       // Rcy is not signed, nor the PWM therefore Rcy minimum must not be less than 6                   analogWrite(PWM10,Rcy);   // Frequency 32kHz timer2}                        } 5. Closed Loop Program, Limited Current Control with Acceleration Handle An acceleration handle provides a 0.8V voltage when not operated and a 4.5V voltage when the handle is fully engaged. Instead of using pushbuttons to increase or decrease the speed setpoint, an acceleration handle will be used Code: [Select] Upoignee=analogRead(A3); // The relation in Upoign and the setpoint which corresponds to the duty cycle corresponds to if (Upoignee>100) { consigne=(Upoignee/2);     //0=a*200+b    et 255=a*800+b                      consigne= consigne-100;                   }                            else { consigne=0;   }               if (Upoignee<100) { consigne=0;  }     // redundancy     6. Temperature and safety program of the motor with the current measurement The outdoor temperature measurement can be easily performed by the LM35 component which charges 0.01V by degrees Celsius Code: [Select] temperature=analogRead(A2); //lm35 0.01V/°C temperature=temperature/2;       // Temperature coefficient lcd.setCursor(5,2); lcd.print("      "); lcd.setCursor(5,2); lcd.print(temperature);   // Display in ° C lcd.setCursor(9,2);      // Erasing secu display lcd.print("     ");   if (temperature>80 ) {lcd.setCursor(9,2);         // If motor external temperature is above 80 ° C                      lcd.print("secuT");                       Rcy=0;} In addition, thermal safety by measuring the motor current will be added. If the limitation current is greater than 10s then the motor will no longer be powered for 30s. A "secu" display will appear on the LCD display. This safety makes it possible to cut the motor on slope too high and when blocking the engine but it would be necessary to add the measurement of the speed in the latter case Code: [Select] if (timesecurite>=10000 ) {flagarret=1;      // If limitation current for a current of more than 10s                               timerepos=0;                               consigne=0;                               Rcy=0;                                 timesecurite=0;}       //   Then stop engine during a downtime    if (flagarret==1 ) {lcd.setCursor(9,2);         // If limiting current for a current of more than 20s                      lcd.print("secU");  }     //   Then stopping the motor for a stop time and display                                                     if (timerepos>=30000 &&  flagarret==1) {flagarret=0;                                           lcd.setCursor(9,2);      // After a rest time here of 30s                                            lcd.print("       ");   }   The display can be observed if the temperature is above 80 ° C https://i58.servimg.com/u/f58/17/56/35/17/a017.jpg Thermal safety by measuring the motor current (digital thermal relay) which allows to know the image of the internal temperature of the engine would be ideal. But for this, it is necessary to know well the thermal modeling of the motor. 7. Measurement of the energy capacity of the battery The energy capacity of a battery is in A.H, we will display the value in mA.H to have a high accuracy. The capacity will be in A.Second in the following equation. So to have in mA.H, it will be divided by capacity by3600. Capacity (A.s) n = I * Te + Cn-1 with Te = 0.01s and I multiplied by 10 So in the interrupt routine Code: [Select] capacity=ImoteurF+capacity ; And in the display Code: [Select] lcd.setCursor(0,3); // Display of energy capacity lcd.print("C mA.h="); capacity1=capacity/(18000);   //18000=3600*5  5=> Current measurement coefficient lcd.print(capacity1); To check a current of 10A with an adjustable resistor and after 30s, the capacity must be 83mA.H 8. Power and modeling with SIMULINK Modeling helps to understand the vehicle and its control. In addition, it is possible to compile the control part directly into the Arduino program from simulation under Simulink. But it will not be possible to simulate the instrumentation with the LCD display. In the following figure, we can observe the simulation of the programming of the chopper with the current limitation with Simulink. In the following figure, the green box shows the duty cycle control to vary the speed and the red border the current limitation. The controller of the control is here a simple integrator but it is possible to carry out a multitude of control. https://i58.servimg.com/u/f58/17/56/35/17/azub_c15.jpg In the previous figure, it can be observed that the current is well limited to 25A from 2s to 9.5s. Then, the current reaches 10.8A under established speed regime at 22.5km / h. The dynamics are similar to the tests carried out. With a slope of 5%, the cyclic ratio reaches only 100% as can be seen in the following figure. The speed will reach painfully 19km / h with a current of 24A and a motor power of 580W. See article: Study of electric scooters 100W and 500W (Arduino), 9. First conclusion It is easy to control a 500W DC motor with an Arduino and some components So repair many scooters that are in DC motors. But it takes some knowledge (automatic, engine) to know how to properly manage the engine and limit its current so as not to damage it The display of the speed, the distance, the operating time to know the Watt.km / km can also be realized with a menu 2. The .ino program as an attached file, But it is not possible to put an attached file in ISIS electronic labcenter? What is this forum? It would be desirable that the compiler could generate the.cof to debug in Isis and test the program line by line .... Arduino still has to make a lot of effort to be on the same level as other microcontrollers 10. speed measurement (tachometer) Velocity measurement is carried out using a hall effect sensor SS495 or A1324 which counts each revolution of the wheel. It is enough to enter the perimeter of the wheel of the scooter (130mm of radius therefore 0.816m in the case To have the speed, it is enough just to divide the number of turn of wheel on an arbitrary time of 1s to have a minimum speed of 0.81m / s therefore of 2.93 km / h. In addition, an average filter with 3 values will be used to display the speed. At 25km / h, there will be 8.5 laps. To count the turns, an external interrupt routine will be used on input INT0 21 of the mega card. http://www.locoduino.org/spip.php?article64 To simulate the speed, a pulse on input 21 will be used with a duty cycle of 10%. https://i58.servimg.com/u/f58/17/56/35/17/a018.jpg Code: [Select] void INT0b21() {   Tspeed++;   // External interruption to count the number of turns } // In the set up declare the interrupt routine when the 5V edge of the magnet detection is done   attachInterrupt(digitalPinToInterrupt(21), INT0b21, RISING );  // External interruption // In loop if (temps09>=5)  {        // 1 second loop lcd.setCursor(13,2);      // Erasing speed lcd.print("kph     "); lcd.setCursor(16,2); speed1=Tspeed*2937;      //1tour*816*3.6/1s=2.937km/h speed2=speed1;           //Tspeed (rate/seconde) speed3=speed2; speedF=(speed1+speed2+speed3)/3000;   // To put in kph lcd.print(speedF,1);    // Display to the nearest tenth Tspeed=0;   // Reset counter temps09=0;  //reset time } To improve the accuracy of the velocity measurement, it is possible that the sampling time of the velocity measurement is dependent on the velocity. For example: For speeds less than 10km / h sample at 1second, but above 10km / h sample at 2 seconds. 11. Distance measurement for autonomy The distance corresponds to the total number of turns of the wheel multiplied by the perimeter of the wheel. So do not set the number of turns to 0 for each sample. On the other hand, the reset of the distance will be done when pressing the reset of the Arduino Mega. The distance display will be displayed to the nearest second. At 32km / h, it will take 2 minutes to do 1km as can be seen in the following figure: https://i58.servimg.com/u/f58/17/56/35/17/a019.jpg Code: [Select] void INT0b21() {   Tspeed++;   // External interruption to count speed   nbrRate++; } lcd.setCursor(13,4);      lcd.print("km      ");  // distance=(nbrRate*816)/1000;  //distance m distance=distance/1000;  //distance km lcd.setCursor(15,4);      lcd.print(distance,1);  You can observe the electrical installation with the chopper, the arduino, and the display when the program is set up https://i58.servimg.com/u/f58/17/56/35/17/dsc_0613.jpg 12. Synthesis The RAM space is used only at 4% and ROM space at 3%, for an Arduino mega. So we could take an arduino a little smaller. But, there are 8 Lipo cells to make the 24V power supply to power the engine via the chopper. Therefore, the voltage measurement of each element will be on the Arduino with a JST connector. This measurement makes it possible to know if a cell with an internal resistance which begins to pose a problem and to know if the balancing of each cell has indeed been carried out. It is possible to switch to 36V with 12 cells also with the arduino mega without using an external shield that multiplex 24 analog inputs on input A0 It is possible to send all data to a smartphone via Bluetooth HC06 via pins 20, 21, RX1 and TX1. But the application under android realized under JAVA Studio can not be shared on this forum. This part will not be explained. After having made the instrumentation of this scooter, a study should be carried out on the precision of the measurements, it is possible to read "Instrumentation of a low-power electrical motor vehicle" eco marathon "type Revue 3EI N ° 81, July 2015 http://www.fichier-pdf.fr/2015/09/07/instrumentation-vehicule-faible-consommation-eco-marathon/

Topic by Iutgeiisoissons 2 years ago


Magnetmotor - really impossible or just supressed?

When someone starts talking about a so called magnetmotor than most people judge right away.Laws of physics, perpetuum mobile is impossible, magnets are static....We all know the limitations nature puts on us... That however did not stop quite a few people since the 1950's to build working magnet motors. Or, to be precise: To make the claim, show them and then somehow disappear. A few though seem to have survived and even claim to make good business. Securely closed machine, stellite tracking and 24/7 online monitoring. Either just a bad and long running hoax or a real attempt to keep a secret secret. Even the somewhat famous Yildiz motor showed off around the world only to disappear.Some like them, some don't. Either way all this sounds like the perfect conspirary theory LOL So lets take a look on what is fake and what might be real but missing some vital clues. You can find several good Youtube channels created by people trying to build a working magnet motor. Some of them have no problems to admit failure and still keep trying and updating their projects. Did long enough and you see two outcomes. The first is giving up or "realising" that it will never work. The second often seems like a user is getting some relly good results and is really close to keep the magnetmotor running. Both disappear without and updates or traces. Now of course this is just confirmation that it will never work, but then again: What if it did already quite a few times? Even Tesla had patents for a magnetmotor and so far none of his patents were a hoax. Although none of his patents allow to actually build a working devices without some additional info and knowledge. And that is the key that I am trying to get: The lost knowledge.How can a magnetmotor never work? That one is quite simple from the start. If a linear model won't work no matter where you start then a rotary version will fail as well. And if a linear version works, it has to do so far at least 5 segments and with preferably increasing or at least constant speed. Having said that and assuming you know a little bit about magnetism: Ever wondered about shapes of magnets?? The common types are block, round like a bar and those disk like ones, some even with holes. A less well known version is the ring magnet. You can look them up as well as their corresponding magnetic field geometry - or what is assumed to be the right geometry. To give you a clue: All those floating spinning toys use a ring magnet in the base and onother one in the spinner. In the center is a dead zone for the magnetic field that is far lower than further out on the ring. And the strnger outer fields also reach further - giving the entire spinner a bowl like area to float on, the spinning just stabilises it like a gyroscope. A similar flat disk magnet wouldn't have this indentation in the field but rather a dome like sphere. The ring just kicks a dint into this sphere if you don't mind the simpification. Similar changes in the field structure happen when you combine two or more magnets. One example we all know is stacking identical smaller magnets. And often we are suprised how much stronger two thin disk magnets are compared to a single. Distance however sets a certain limit. And take those hook magnets... Just a small ring magnet in a metal pot with core. Remove the magnet and just by itself it is far weaker. Why? Quite simple.... The same way a transformer core directs the magnetic flow, the metal part of the hook magnet provides a shortcut for the magnetic field - and in return all is much stronger ;) Now you have some more clues, but still there are tons of options for failure... The most common is the sticking effect. No matter how well you planned and designed in most cases you linear or rotary prototype will stall sooner or later. Even if started manually at high speeds some seem to run very long but once they slow down and stop it is obvious they always stop where the magnetic field won't allow the binding effect to be overcome.Wouldn't dare to say that I have a working magnetmotor, but I might have some clues you want to try if you decide to give it a try yourself. So how COULD a magnetmotor actually work? Like in the Perendiv examples all over the web, you could aloow a moving responder to the rotor. Like a piston the responder will be lifted in areas it would otherwise limit or reduce the speed of the system. Well designed only a few mm would b required but it also means wasted energy to move the responder. Then there is the nice way of modifying fields by adding magnets in different angles and polarities. Lets say towards the end of your stages on the linear model it is hard to overcome the binding effect from the end of the previous stage. The perendiv model would now somehow change the distances. But you can also add magnets to lower the binding effect ;) Like a ring or hook magnet you can shape the field and offer a stronger repulsin field or a lower binding force. Last but certainly not least is the option of adding magnetic metals like iron or somehow weirder ones like bismuth. So, do we have any examples of something very common utilising any of this? We sure do :) Take a speaker apart and you end with the cage, the membrane, the actual work coil and the magnet. We don't need anything but the magnet so take a good and very close look. What in the audio world is called a shield to prevent the magnet from messing with things close by is exactly the same as on a hook magnet ;) Only difference is the tiny gap for the coil. The magnetic field is directed into two paths, one by the metal core, the other by the inner enclosure of the magnet or the magnet itself. The coil operates in the area of maximum flux.Last hints... If you take two identical and strong magnets with north or south facing up then it is quite hard to push them very close together. But check what happens if you try the same wen both soth poles (or both north poles) are placed on a magnetic surface - if in doubt your standard fridge door. Suddenly you can move much closer together with the same amout of force (not considering the added friction!). And similar story for opposing configurations. Where in free air or on a table the magnets would just jump together, on a metal plated you can move them much, much closer before this happens. Copper pipe and magnet fun :) Ideally you would have a straight copper pipe and a cylindrical magnet that has a loose fit in the pipe. Aluminium pipe work too or even a roll of aluminium foil if you have nothing else. A magnet in the pipe will travel very slow down the pipe, friction is not an issue here. So what is slowing it down? The magnet creates a field in the pipe and through that the pipe generates electicity. And funny enough this electricity creates an opposing magnetic field in the pipe - the magnet slows down. Even if you glue it onto a wooden stick it won't rush through it. Trying to push it by hand and you feel the created resistance. The faster you push, the harder it is to push! If you made it all the way down here with the reading then I have to assume you fit into one of three of my categories. a) You are a total sceptic and just read it for your amusement. If so, then please don't post a reply with usual negative feedback, instead see it as the same fun you had reading it ;) b) You are at least curious and like to play with magnets. In this case take the above as inspiration to explore more ways to have fun with your magnets! c) You are more or less frustated because you wasted a lot of time and some money to build a magnet motor that just won't work. A and B might go on and enjoy the fun, C however might want to read very attentive now ;) If you take some indicator sheet for magnetic fields, like these funny green ones, and play with moving magnets then you see a very interesting effect on the "screen". The otherwise static field lines change chape and sometimes even seem to disappear or shrink. With a small rotor assembly it almost looks like flashes when the magnets move past each other. This effect is often totally neglected and to be honest I overlooked it for a long time as well. Being able to see how the magnetic field changes gives the thing an whole new dimension so to speak. Creating a magnet with a complex shape is difficult to say the least. Only ferrite or ceramic ones can be used and you would cut of machine them according to your desired shape and with regards to the orginal center of the magnetic field. So most people revert to the classic way of shaping by adding magnets of various types, sizes and amounts. Modern neodymium magnets make this trial and error process easier as there are many sizes and strengths available. Add a detector shield of suitable size and you have hours of fun time ahead of you. But doing so in any rotary assembly is next to impossible. So what did Yildiz differently and what was missed so many times? Yildiz took it a step further and not only provided "shunts" to create very strong magnetic field from the generated electricity but also a second rotor. Since we all start small lets focus on the basics first. Remember the hook magnet and speaker or the copper pipe? Some examples for shape shifting your otherwise static magnetic fields: 1. A magnetic metal "connection" from one (low in the armature) pole to an opposing (high in the amature) pole with cause the field from the "high" pole to "bend" towards the connected magnet. 2. A magnet with an orientation of 90° to the last magnet is the sequence will severely influence the field of this last magnet! This goes for either orientations! 3. Adding a non-magnetic "shield" around a magnet, like a piece of copper pipe, will not affect the static field of the magnet. However it will severely alter the field of the enclosed magnet when another magnet passes it! It will also affect the overal field during the passing as the moving magnet will also induce a field in the copper by affecting the field of the enclosed magnet! Thickness and lenght of the shield influence the strength of these effects. 4. In a simple perendiv motor design the bar that creates the attraction for the spinning part is a magnet too. Either a long bar type or two small ones with an iron or nickel rod between them. There is no need for a piston or something that drives the bar up or out of the way ;) Just use the right magnet at the right spot on your rotor to repell the bar ;) Mount the ar with suitable springs and you suddenly can have multiple stages on your rotor instead of just the usual one! Don't forget the moving magnet on the opposing side of the segment in question though as otherwise you still will get stuck. (Hint: You can place a small but powerful magnet in the center of the opposing bar ;) Just make sure you limit the springs movement so the bar won't be pulled closer)Ok, hold on now! Does a magnet motor actually work or not? I can only give hints and say the laws of physics as we know them apply to magnetmotors the same way as everything else. Unlimeted motion without supplying energy is not possible. Limited motion with adding or using energy however is still possible and real. The same is true for being able to machine, 3D print or otherwise manufacture at very tight tolerence and accuracy levels. This includes bearings or bearing systems with very little friction losses. Just check these floting and rotating magnet toys that look like a spindle. Only a tiny needle like pin makes contact with a glass surface - next to no friction loss. A proper and supposedly working magnet motor should provide more energy than what it uses - one way or the other. No law of physics lets us get around the fact that such a motor could only keep spinning if the produced power or motion energy is at least the same as what is required to make it move. Magnets lose their strenght over time, they are like a very slowly depleting battery. So, isn't it funny that all magnet motors so far that claimed to work also had the requirement to replace the magnets once the things fails to work or start? And if you leave a very strong neodymium magnet shielded from outside fields or magnetic stuff than your grandkids will still find a quite strong magnet. Do a little performance test with your new magnets, like how much force is required is required to lift them off a steel plate. Make the same test with the magnets once you played around extensively with them in your motor. Now take a spare magnet that was never used from the orginal batch and compare both against each other ;) If the motor would not use energy then why are the magnets depleted to a certain degree, realted to runtime and usage time? Wait a minute! Does that now mean it actually works? Lets just say energy is certainly used. We only know similar effects from electromagnetic systems. But did anyone ever really check how much actual energy is in magnetic field generated by a non electric magnet? Get a good sized N52 neodymium magnet and check how much force is required to pull it off a steel surface. Now try to get the smallest sized electromagnet capable of that force and check how much energy it consumes at the level that equals the pulling force of the N52 magnet ;) Makes no sense to even try to compare these you will say now. I just say energy is energy and we were formed to only think in certain ways and don't even try silly things like this ;) To keep the fun up let us imagine we would actually have a similar energy available than what our electro magnet would require. In reality more because we wouldn't have electrical or flux related losses in the metal around the coil. Or is the imagined reality, no clue ;) If true it would mean even a motor with very bad efficiency would be able to create huge amounts of torque. Well, torque is basically acceleration. Which would mean our motor would not just be happy to spin, it would speed up until the bearing fail or the thing is ripped apart. Imagine a dental drill of that size and weight suddenly falling apart at full speed... Every example of motors claimed to be working, that are not fakes, seem to be happy no matter what the load is. It the thing turns a generator than it would have to slow down a bit with the increased load but they don't. With no limited factors otherwise this makes them a fake. Even a perfect motor would have to react to load changes.... Don't we agree that the stronger the magnetic force or field in a conductor the stronger the resulting magnetic and opposing field of the conductor? We use the difference to either drive a motor or take out electricity... But if you take the "open" shielding of a magnet in a changing field than the influence of the shield on the overall field gets stronger with stronger field changes. And properly desinged and orientated they would actually double as a natural limiter for the rotation speed. Once the electrical energy in the shield becomes too strong it will be able to cancel out the field of the enclosed magnet...If we assume a magnet motor is really possible and works with the intended output to keep it spinning or even take energy out: Then what would be possible downfalls that stop this thing happening in everyones garage? We can explore the stars but so far no one bothered to invent anything to visualise magnetic field in a 3 dimensional way other than by simulation. No realtime and true observation like this. The few working technologies that exist rely on sensors, interpretaion and filling in gaps. But imagine something like a detector shield as cloud! And then even better with selctive spacing to get a realtime view of where exactly the field lines go. All we can do is forget our teaching and try it out anyway ;) If by some mistake a magnet motor would really work right away, then chances are high the inventor would wonder why that thing takes off like mad and how to stop it. Unless well prepared it would certainly end in the destrution of the motor. But the inventor would know what to look for in the next prototype. The logical conclusion would be to the couple the energy taken to the speed while physically limittin the free load speed. The other one would be the design the electrical generator around the and within the motor. To even get close to this point you would have to spend endless days and nights working on finding a solution. The closer you get the more disappointment when the final model still fails to keep spinning for more than a few hours. Most people will then accept defeat and move on... Still not saying it actually works but if you made it to this point in time where it could be easier to move on and do other things:Ever wondered what would happen if you "shield" a magnet with a coil? Of course nothing would happen as we know. But try this in some fixed assembly that allows you move another magnet through the field of the shielded one. Perferably witha force gauge or some option to read out the energy required to move it through the various stages of the field. See what happens if you short the coil or add a resistor to it ;) Now if this coild is able to produce electricity then the more we use the more the effects on the required force would change. What do you think would happen if you combine common coil relations of electric motors to a "coil shielded" magnet motor? Right, all these coils would interact with the magnetic fields of the coils they are connected to... And through that with the overall field surrounding the enclosed magnet..... I leave up to you to imagine how these interacting coils could provide "resistance" or "acceleration"/"surplus electricity"...Like they say: You can only find out if you try ;) To keep up the positive thinking: A permanent magnet just sticks to any magnetic surface and does so with the same force. But the real energy loss in terms of getting weaker can almost be neglected. Any electromagnet capable of the same holding force woul require ongoing energy supplies to keep it up. It is using energy the same way the permanent magnet does! The difference is the permanent magnet is not seen as anything that would provide us with energy.... And if it can't provide energy other than passing through coils then why the heck does it keep sticking to the fridge year after year? It does require energy to keep this weight up doesn't it, even if you add a thin teflon disk and oil to reduce friction? ;) No magic, no "free energy" bogus, just plain physics viewed from a slightly different angle than what we learn in school ;) Have a good laugh and a good beer, then read it again and just consider some of the things here that are not mentioned in any literature about magnetism that we commonly use. Now I got you thinking, didn't I ? ;)

Topic by Downunder35m 2 months ago  |  last reply 2 months ago