Keyboard Shortcuts
Likes
- BITX20
- Messages
Search
Re: Help with rotary encoder code, please, anyone?
Jack Purdum
That code won't run on an Uno...there isn't enough memory. However, you should be able to extract parts of it, leaving the graphics calls out (i.e., calls to any tft.functionName() ) which will shrink the code size a lot. Make sure you're using pins 2 and 3 for the interrupts. Jack, W8TEE From: John P <j.m.price@...> To: [email protected] Sent: Sunday, July 30, 2017 4:02 PM Subject: Re: [BITX20] Help with rotary encoder code, please, anyone? On Sun, Jul 30, 2017 at 12:50 pm, Jack Purdum wrote: Finally, which "VFO code" are you using in your code and where does that code come from or are they both the same code?VFO?code came from one of your posts on here.? I didn't see the AttachInterrupt code when I looked. I'll?give that a try! Thanks! ? -- John - WA2FZW |
||
Re: Help with rotary encoder code, please, anyone?
John P
On Sun, Jul 30, 2017 at 12:50 pm, Jack Purdum wrote:
Finally, which "VFO code" are you using in your code and where does that code come from or are they both the same code?VFO?code came from one of your posts on here.? I didn't see the AttachInterrupt code when I looked. I'll?give that a try! Thanks! ? -- John - WA2FZW |
||
Re: Help with rotary encoder code, please, anyone?
John,
Rotary encoders by using polling has some difficulties, as you now realize. Interrupts work for me. Attached is a simple example (REserial.ino) that just reads direction to your serial monitor as you were doing. Also attached is a BITX Raduino application that demonstrates a practical sketch (EZ_RE_S_P.ino). Does this help? If you have any questions my email is ND6T@... and I would be glad to try to assist. 73, Don,ND6T |
||
Re: Help with rotary encoder code, please, anyone?
Jack Purdum
The encoder interrupt pins are "activated" using this code near line?252: ?Rotary rotary = Rotary(ENCODERPINB, ENCODERPINA); ? ? ? // Interrupts #5 and 4 on the Mega You also need these lines from setup(): ? pinMode(ENCODERPINA, INPUT_PULLUP); ? pinMode(ENCODERPINB, INPUT_PULLUP); ? attachInterrupt(digitalPinToInterrupt(ENCODERPINA), DoMenuSelect, CHANGE); ? attachInterrupt(digitalPinToInterrupt(ENCODERPINB), DoMenuSelect, CHANGE); You need to supply a DoMenuSelect() function to process the encoder movement. Without that, it won't work.? Finally, which "VFO code" are you using in your code and where does that code come from or are they both the same code? Jack, W8TEE From: John P <j.m.price@...> To: [email protected] Sent: Sunday, July 30, 2017 3:34 PM Subject: Re: [BITX20] Help with rotary encoder code, please, anyone? On Sun, Jul 30, 2017 at 10:32 am, Jack Purdum wrote: Thanks Jack. I originally had it on pins 9 & 10 but moved it to 2 & 3. Trying to do it without the interrupts, which I think is the way your VFO code works (at least I didn't see anything in the VFO code to set up the interrupts). Again,?after playing around with it for hours, I basically cloned your code ant it still doesn't work. And I did try reversing 2 & 3 with no effect. ? -- John - WA2FZW |
||
Re: On the Air! Finally!
Jack Purdum
Hi Dave: Attached is an article I did for QRP Quarterly on using the mic parts that come with the BITX40 to make a mic. My cost was under $1. Jack, W8TEE From: David Wilcox via Groups.Io <Djwilcox01@...> To: [email protected] Sent: Sunday, July 30, 2017 3:33 PM Subject: Re: [BITX20] On the Air! Finally! I like your mic. ?How did you mount it in the pvc tube and did you add any packaging or padding material inside or any spit screen in front of mic cartridge? I was thinking of using a smaller diameter pvc tube but your larger size looks good and more functional to hold in your hand. Dave K8WPE
|
||
Re: Help with rotary encoder code, please, anyone?
John P
On Sun, Jul 30, 2017 at 10:32 am, Jack Purdum wrote:
Thanks Jack. I originally had it on pins 9 & 10 but moved it to 2 & 3. Trying to do it without the interrupts, which I think is the way your VFO code works (at least I didn't see anything in the VFO code to set up the interrupts). Again,?after playing around with it for hours, I basically cloned your code ant it still doesn't work. And I did try reversing 2 & 3 with no effect. ? -- John - WA2FZW |
||
Re: On the Air! Finally!
David Wilcox
开云体育I like your mic. ?How did you mount it in the pvc tube and did you add any packaging or padding material inside or any spit screen in front of mic cartridge? I was thinking of using a smaller diameter pvc tube but your larger size looks good and more functional to hold in your hand. Dave K8WPE On Jul 30, 2017, at 12:40 PM, Eric Torraca <eric.torraca@...> wrote:
|
||
Re: Lovely LM386?
I know it is not perfect. But the LM386 seems noisy and micro phonic. It might even be oscillating some at full volume.
I can turn it all the way up and smack the LM386 with the handle of a small screwdriver and hear the smack in the speaker. I may have something going on ahead of the audio to cause this? I still have the gain capacitor across the LM386 (stock bitx config). Mike, WA6ISP |
||
Re: Help with rotary encoder code, please, anyone?
I took and old version and added conditional assembly code. Have not done it for a real recent version.
You add stuff in setup to get interrupt going too. You substitute the tuning code. you add the interrupt Here is the original "dotunning" for Pot. I made the same function so it interfaces with original code. This is just a hack to get rotary working and be able to switch back with commenting out #define ENCODER My bump switch sets the "Step" Hz amount. This (for now) clobbers out stuff on line 2. So this is just a start, but runs with an Encoder. this is NOT Encoder, see below code for tuning with encoder' I am ON PAGE 100 of Jacks wonderful C Book! Mike, WA6ISP ......................................................................................................... #ifndef ENCODER //*** /** The Tuning mechanism of the Raduino works in a very innovative way. It uses a tuning potentiometer. The tuning potentiometer that a voltage between 0 and 5 volts at ANALOG_TUNING pin of the control connector. This is read as a value between 0 and 1000. By 100x oversampling ths range is expanded by a factor 10. Hence, the tuning pot gives you 10,000 steps from one end to the other end of its rotation. Each step is 50 Hz, thus giving maximum 500 Khz of tuning range. The tuning range is scaled down depending on the limit settings. The standard tuning range (for the standard 1-turn pot) is 50 Khz. But it is also possible to use a 10-turn pot to tune accross the entire 40m band. In that case you need to change the values for TUNING_RANGE and baseTune. When the potentiometer is moved to either end of the range, the frequency starts automatically moving up or down in 10 Khz increments */ void doTuning() { long knob = knob_position(); // get the current tuning knob position // the knob is fully on the low end, move down by 10 Khz and wait for 200 msec if (knob < -80 && frequency > LOWEST_FREQ) { baseTune = baseTune - 10000L; frequency = baseTune + (50L * knob * TUNING_RANGE / 500); updateDisplay(); setFrequency(frequency); delay(200); } // the knob is full on the high end, move up by 10 Khz and wait for 200 msec else if (knob > 10120L && frequency < HIGHEST_FREQ) { baseTune = baseTune + 10000L; frequency = baseTune + (50L * knob * TUNING_RANGE / 500); setFrequency(frequency); updateDisplay(); delay(200); } // the tuning knob is at neither extremities, tune the signals as usual ("flutter fix" by Jerry, KE7ER) else if (knob != old_knob) { static byte dir_knob; if ( (knob > old_knob) && ((dir_knob == 1) || ((knob - old_knob) > 5)) || (knob < old_knob) && ((dir_knob == 0) || ((old_knob - knob) > 5)) ) { if (knob > old_knob) { dir_knob = 1; frequency = baseTune + (50L * (knob - 5) * TUNING_RANGE / 500); } else { dir_knob = 0; frequency = baseTune + (50L * knob * TUNING_RANGE / 500); } old_knob = knob; setFrequency(frequency); updateDisplay(); } } if (vfoActive == VFO_A) vfoA = frequency; else vfoB = frequency; } #endif This is new Do Tunning for Encoder //*** #ifdef ENCODER void doTuning() { //**** //Read Encoder Bump Switch if (!digitalRead(BUTTONSW)) { delay(1); unsigned long Time = millis(); while ( !digitalRead(BUTTONSW) && ( (millis() - Time) < 1000) ) { delay(1); T1++; } if (digitalRead(BUTTONSW)) { Bumps++; } } if (Bumps > 3) Bumps = 0; #ifdef DEBUG Serial.print("Bumps = "); Serial.println(Bumps); #endif lcd.setCursor(0, 1); lcd.print("Step="); switch (Bumps) { // case 0: // Steps = TENS; // lcd.print(msgten); // break; case 0: Steps = HUND; lcd.print(msgh); break; case 1: Steps = KIL001; lcd.print(msg1k); break; case 2: Steps = KIL010; lcd.print(msg10k); break; case 3: Steps = KIL100; lcd.print(msg100k); break; default: Steps = KIL001; lcd.print(msg1k); Bumps = 0; break; } if (frequency >= 7350000UL) frequency = 7350000UL; if (frequency <= 7000000UL) frequency = 7000000UL; /* if (Move == -1) { frequency += Steps; //1KHz = 1000 } if (Move == +1) { frequency -= Steps; } */ setFrequency(frequency); updateDisplay(); Move = 0; if (vfoActive == VFO_A) vfoA = frequency; else vfoB = frequency; } #endif Then the interrupt.... // The Interrupt from Rotary Lib // Increments or Decriments Move variable ISR(PCINT2_vect) { unsigned char result = r.process(); if (result == DIR_CW) { // Serial.println("ClockWise"); frequency += Steps; //1KHz = 1000 } else if (result == DIR_CCW) { // Serial.println("CounterClockWise"); frequency -= Steps; //1KHz = 1000 } } And in SETUP>>>>>>>>>>>>>>>//*** //Encoder // #ifdef ENCODER pinMode(BUTTONSW, INPUT_PULLUP); pinMode(2, INPUT_PULLUP); pinMode(3, INPUT_PULLUP); PCICR |= (1 << PCIE2); PCMSK2 |= (1 << PCINT18) | (1 << PCINT19); sei(); #endif -- Mike Hagen, WA6ISP 10917 Bryant Street Yucaipa, Ca. 92399 (909) 918-0058 PayPal ID "MotDog@..." Mike@... |
||
Re: On the Air! Finally!
The tuning voltage into the Raduino is somewhere between 0 and 5v, determined by the position of the pot. ?Doesn't make much difference if the pot is 1k or 100k, the pot is simply a voltage divider. ?Somewhere above 100k, tuning voltage will be affected by the internal resistance of the Raduino's analog pin, and under 1k that pot starts sucking appreciable current from the battery. ? I suggest you download Allard's code from ??to your Raduino, then adjust the high and low tuning limits in the Allard's settings menu. ? Here's a comment from his sketch:
toggle quoted message
Show quoted text
??In the SETTINGS menu we can limit the tuning range depending on the potentiometer used and the band section of interest. ??Tuning beyond the limits is still possible by the 'scan-up' and 'scan-down' mode at the end of the pot. ??At the two ends, that is, the tuning starts stepping up or down in 10 KHz steps. ??To stop the scanning the pot is moved back from the edge. Jerry, KE7ER? On Sun, Jul 30, 2017 at 09:40 am, Eric Torraca wrote: The only thing I'm not keen on is the travel of the pot before it switches to 100 kHz steps. Has anyone had any success with mods that folks have done to give more travel? I tried a 1meg pot but it didn't seem to make much difference. Aside from that, I'm thrilled to have it on the air. |
||
Re: On the Air! Finally!
Vince Vielhaber
What's the NEC board?
toggle quoted message
Show quoted text
Vince. On 07/30/2017 12:40 PM, Eric Torraca wrote:
Good afternoon all. --
Michigan VHF Corp. |
||
Re: Help with rotary encoder code, please, anyone?
Jack Purdum
At least part of the problem is that my encode is using a Mega 2560 Arduino, which has 5 external interrupts while the Nano and Uno only have two. Near the top of my code (line 120) are: #define ENCODERPINA ? ? ? ? ?19 ? ? ? // Encoder pin A, interrupt 5 #define ENCODERPINB ? ? ? ? ?20 ? ? ? // Encoder pin B, interrupt 4 #define ENCODERSWITCH ? ? ? ?22 ? ? ? // Encoder switch pin which are the pins used for the encoder. You need to use interrupts 0 and 1, which means pins 2 and 3. Try: #define ENCODERPINA ? ? ? ? ?2????????// Encoder pin A, interrupt 0 #define ENCODERPINB ? ? ? ? ?3????????// Encoder pin B, interrupt 1 #define ENCODERSWITCH ? ? ? ?22 ? ? ? // Encoder switch pin If the encoder rotation is "backwards", reverse pins 2 and 3. (I can't remember which is which.) The ENCODERSWITCH is the switch that's part of the Ky-040 encoder and you can set that to whatever empty pin you want to use. See what these changes do. Jack, W8TEE From: John P <j.m.price@...> To: [email protected] Sent: Sunday, July 30, 2017 1:21 PM Subject: [BITX20] Help with rotary encoder code, please, anyone? So, I've been trying to get my Arduino UNO to read a rotary encoder. And have been having zero success (beyond a clean compilation). I'm using the , which is the?same one Jack uses in his VFO code, and I basically cloned the code to read the encoder from Jack's VFO code. No matter which way I turn the encoder, the Rotary.process() function always returns zero. In Jack's code, he calls the Rotary constructor with PinB first, which I found a little confusing. But, I tried both ways and neither works. I tried with HALF_STEP both enabled and disabled in the Rotary.h file. That didn't make any difference either. Using a voltmeter, I can see both the A & B pins changing state as I turn the knob and even tried a different encoder just in case. Didn't matter. So, I'm about to throw my Arduino at the wall! Just kidding! If anyone can see what I'm doing wrong in the attached code, please tell me. I've spent about 8 hours fiddling with it so far, and can't figure it out! Thanks in advance! -- John - WA2FZW |
||
Help with rotary encoder code, please, anyone?
John P
So, I've been trying to get my Arduino UNO to read a rotary encoder. And have been having zero success (beyond a clean compilation).
I'm using the , which is the?same one Jack uses in his VFO code, and I basically cloned the code to read the encoder from Jack's VFO code. No matter which way I turn the encoder, the Rotary.process() function always returns zero. In Jack's code, he calls the Rotary constructor with PinB first, which I found a little confusing. But, I tried both ways and neither works. I tried with HALF_STEP both enabled and disabled in the Rotary.h file. That didn't make any difference either. Using a voltmeter, I can see both the A & B pins changing state as I turn the knob and even tried a different encoder just in case. Didn't matter. So, I'm about to throw my Arduino at the wall! Just kidding! If anyone can see what I'm doing wrong in the attached code, please tell me. I've spent about 8 hours fiddling with it so far, and can't figure it out! Thanks in advance! -- John - WA2FZW |
||
Re: On the Air! Finally!
Eric KB1VNA wrote...
Attached are a couple of photos of the completed unit.I like your case! The only thing I'm not keen on is the travel of theAre you sure it isn't going to 10 KHz steps when you get to the ends of the pot? I was originally going to do the mod adding a fixed resistor on the top and bottom ends of the pot with a push-button across each resistor to manually step up and down, but I have a 10-turn pot on the way that will actually do away with "galloping" or manually stepping up and down. /g/BITX20/topic/fixing_the_galloping_vfo/4552318?p=,,,20,0,0,0::Relevance,,galloping,20,2,0,4552318 Raduino is up to v1.20.1 now, but the following description from 1.04 should still apply. /g/BITX20/topic/raduino_v1_04_allowing/4694574?p=,,,20,0,0,0::Relevance,,10+turn+pot,20,2,0,4694574 I should be back on the air with a BITX40 within a day or two. I'm waiting for a replacement IRF510 to show up. However, I'll be listening on 7277 KHz this evening. -- 73 Keith VE7GDH |
||
On the Air! Finally!
Good afternoon all.
I've finally got a Bitx40 on the air! Another local ham had acquired a Raduino version and decided he had too many projects to get it going so he sold it to me for just under cost. I swapped it out with the original version Bitx40 in the case that I'd already made and hooked it up as directed. It appears to be working exactly as designed. Phew! It's been a long time getting something on the air! Attached are a couple of photos of the completed unit. The only thing I'm not keen on is the travel of the pot before it switches to 100 kHz steps. Has anyone had any success with mods that folks have done to give more travel? I tried a 1meg pot but it didn't seem to make much difference. Aside from that, I'm thrilled to have it on the air. I'll keep working on the original non-radiuno version, but at least it's not keeping me from getting contacts. I made a couple yesterday immediately after finishing the build.? All the best! 73 de KB1VNA Eric |
||
Re: I7SWX PTT Pop Mute
I checked my work and found a wrong connection on my part.? I fixed the connection and the circuit now works as described, reducing the PTT pop and noise on initial transmit. ? I did not experience an issue with transmit, it seems to be working normally.? There is a slight click when entering TX and a slightly louder pop when exiting TX, but neither are as loud as the PTT pop before adding this modification. The audio is silent during transmission.
Sorry about the false alarm in #30619. This modification is a worthwhile addition to any BITX40. /g/BITX20/attachment/21876/0/BITX-40%20PTT%20CLICKS.png |
||
Re: BitX on Display at HamQuest in Lebanon TN
Doug Paulson
Excellent advocacy David. Happy to be one of the followers. Doug? KA4DXX? On Sat, Jul 29, 2017 at 4:37 PM Dave Matthews <dave@...> wrote:
|
||
Re: VK3YE AGC questions, description of how it works? and how to make it more effective?
chris gress
Look how I connected mine in the post before the one you posted my audio was bad till I changed the input to the AGC circuit I also dropped the audio gain of the audio amp between pins 1,8 there's a cap add a 1,2k ohm ? ie ?----l l----R----- ?it makes the audio lower but I only use headphones so its OK ? On 30 Jul 2017 02:45, "KC8WBK via Groups.Io" <cruisenewsnet=[email protected]> wrote: I think that I had the VK3YE AGC installed correctly, but the audio output had the high tones clipped off, and there was a motorboating sound with the audio that I could hear. I could understand, but there was distortion. ? Could this be because I used ceramic capacitors and not electrolytic? |
||
Re: BitX on Display at HamQuest in Lebanon TN
hey, that is a very nice picture of the bitx40 break down! - f On Sun, Jul 30, 2017 at 3:40 AM, Doug Paulson <Canpilot1@...> wrote:
|
||
Re: Finished to build but LCD noise.
开云体育About “ground loops” please read...
?
?
? Sent: Saturday, July 29, 2017 11:08 PM
Subject: Re: [BITX20] Finished to build but LCD
noise. ?
I'm just getting started with Diptrace,
so this is the best I can do right now.
All of the electrolytic capacitors are 330uF 16V and all the rest are 0.1uF disk ceramics. I separated out J1's 12V in case I want to up the voltage and throw a 7812 into the other leg. I probably should have used higher voltage caps, but it's what I have on hand and, so far, seems to work fine. Each set of ground pins associated with each connector is tied to the ground leg of the final bypass capacitor. That is, the ground pins for J2 tie to the ground leg of C4, for J3 it's C13, and for J1 it's C12. I had connectors on the schematic for the ground pins, but I thought it cluttered it up. The single ground point is important. I'm sure someone with real EE skills
can do a better job with the schematic and explanation of avoiding a ground
loop. I've attached a JPG of the schematic, too.
Jack,
W8TEE
From: CX8ABF Carlos Molina <cx8abf@...> To: [email protected] Sent: Saturday, July 29, 2017 11:57 AM Subject: Re: [BITX20] Finished to build but LCD noise. ?
Thanks Jack
73 Carlos
?
Sent: Saturday, July 29, 2017 12:05 PM
Subject: Re: [BITX20]
Finished to build but LCD noise. ? I'll try to get
that done this weekend and then post it.
Jack,
W8TEE
From: CX8ABF Carlos Molina <cx8abf@...> To: [email protected] Sent: Saturday, July 29, 2017 10:55 AM Subject: Re: [BITX20] Finished to build but LCD noise. ?
Please Jack,
send us the schematic
of the modified PSU.
?
73 Carlos
CX8ABF
?
?
|