UK Vintage Radio Repair and Restoration Powered By Google Custom Search Vintage Radio Service Data

Go Back   UK Vintage Radio Repair and Restoration Discussion Forum > General Vintage Technology > Components and Circuits

Notices

Components and Circuits For discussions about component types, alternatives and availability, circuit configurations and modifications etc. Discussions here should be of a general nature and not about specific sets.

Reply
 
Thread Tools
Old 30th Aug 2019, 3:42 pm   #1
Julesomega
Hexode
 
Julesomega's Avatar
 
Join Date: Dec 2012
Location: Stockport, Greater Manchester, UK.
Posts: 414
Default Embedded Control for a newbie

A lot of questions for anyone who could help me to learn how to use microcontrollers for embedded control. A friend is going to give me an introduction to Python which is taught in schools these days and as soon as I can emulate a set of traffic lights I shall start on the real business.

My immediate goal is to generate the code to drive the AD9850/AD9851 DDS Signal Generator Modules which you can buy a lot cheaper than having a crystal cut, plus you can emulate an entire bank of crystals with one module.

My first question then is what device to choose as controller. People use Raspberry Pi, Arduino or Seeeduino for this sort of thing, but they seem overkill as they could pilot a spaceship to Mars, plus you need a shield or some such interface. The original microcontroller was the Peripheral Interface Controller from Microchip but PICs now qualify as vintage technology on these pages so what do people recommend for simple control? I don't think I need ADC, though it would provide the simplest switching for multiple frequency use. I'm hoping boards can be bought ready populated with the controller and presumably a serial interface for loading the code.

The second question is what language to use for generating the code. Life's too short to try learning machine code, and speed is not important in this application, unless one wanted to modulate the generator with audio. I was assuming that C++ is the language of choice used by us hardware engineers, but should I be considering a later language or something object oriented?
__________________
- Julian

It's good here
Julesomega is offline   Reply With Quote
Old 30th Aug 2019, 4:01 pm   #2
MrBungle
Dekatron
 
MrBungle's Avatar
 
Join Date: Jun 2016
Location: London, UK.
Posts: 3,373
Default Re: Embedded Control for a newbie

If it's a one off then I'd use an Arduino and use their *******ised version of C++. There are libraries that get rid of the nuances of driving an AD9850.

Myself, I use AVR-gcc and AVRs generally as the toolchain is familiar (as a C systems programmer by trade among other weird things)
MrBungle is offline   Reply With Quote
Old 30th Aug 2019, 4:23 pm   #3
cmjones01
Octode
 
Join Date: Oct 2008
Location: Warsaw, Poland and Cambridge, UK
Posts: 1,900
Default Re: Embedded Control for a newbie

Yes, what MrBungle said. Remember that a basic Arduino is nothing more than a quite basic Atmel AVR chip (similar to a low-end PIC) soldered to a circuit board with a convenient USB interface and an easy programming environment. It's a good way to start with embedded control, and microcontrollers don't get much simpler than this.

I use the very same range of AVR chips in various commercial products, but squeeze more sophisticated and reliable behaviour out of them with more advanced programming techniques using Atmel's 'AVR Studio' environment, which uses AVR-gcc under the bonnet. The hardware is the pretty much the same as an Arduino, though!

Chris
__________________
What's going on in the workshop? http://martin-jones.com/
cmjones01 is offline   Reply With Quote
Old 30th Aug 2019, 4:53 pm   #4
ChristianFletcher
Hexode
 
ChristianFletcher's Avatar
 
Join Date: Dec 2003
Location: South Yorkshire, UK.
Posts: 317
Default Re: Embedded Control for a newbie

Another on for Arduino. Because you will find more tutorials to get you started than any other device. There are lots of different versions and peripheral shields and even serious cheap clones from China.

Note the noise and hash from some of those frequency synthesis are seriously horrible. I know people have done good things with them but I wouldn’t consider them a good alternative to a Crystal or really signal generator. But that’s just opinion.

Have fun
__________________
Every Silver Lining Has Its Cloud !
ChristianFletcher is offline   Reply With Quote
Old 30th Aug 2019, 5:47 pm   #5
MrBungle
Dekatron
 
MrBungle's Avatar
 
Join Date: Jun 2016
Location: London, UK.
Posts: 3,373
Default Re: Embedded Control for a newbie

Really after futzing around with the same thing (and Si5351's), depending on budget or commercial or hobby nature I found it was cheaper (than my time and patience) to buy a Rigol AWG and use that for this sort of stuff. You can plug an ethernet cable in it, hook it to your LAN and drive it via python remotely. Bonus I found out is you can crack the DG1022Z to push it from 25 to 60MHz ceiling
MrBungle is offline   Reply With Quote
Old 30th Aug 2019, 7:28 pm   #6
Julesomega
Hexode
 
Julesomega's Avatar
 
Join Date: Dec 2012
Location: Stockport, Greater Manchester, UK.
Posts: 414
Default Re: Embedded Control for a newbie

Thanks guys, sounds like I should concentrate on the Arduino, though that will make for a rather large crystal replacement.

I was puzzled over the Rigol suggestion, and it turns out they are high-end laboratory test equipment signal sources, not at all what I'm looking for.
__________________
- Julian

It's good here
Julesomega is offline   Reply With Quote
Old 30th Aug 2019, 7:42 pm   #7
buggies
Hexode
 
buggies's Avatar
 
Join Date: Jan 2009
Location: West Lothian, UK.
Posts: 357
Default Re: Embedded Control for a newbie

Quote:
Originally Posted by Julesomega View Post
Thanks guys, sounds like I should concentrate on the Arduino, though that will make for a rather large crystal replacement.
As mentioned in post #3, the Arduino is really just an AVR chip with easy connections. If you use a cheap version with the DIL chip in a socket, you can get the programming right first, then remove the programmed chip and fit it in a veroboard layout with your choice of other parts required (crystal and a few caps minimum).
__________________
George
buggies is offline   Reply With Quote
Old 30th Aug 2019, 7:50 pm   #8
MrBungle
Dekatron
 
MrBungle's Avatar
 
Join Date: Jun 2016
Location: London, UK.
Posts: 3,373
Default Re: Embedded Control for a newbie

Quote:
Originally Posted by Julesomega View Post
Thanks guys, sounds like I should concentrate on the Arduino, though that will make for a rather large crystal replacement.

I was puzzled over the Rigol suggestion, and it turns out they are high-end laboratory test equipment signal sources, not at all what I'm looking for.
Yes and no. They’re between 10 and 20 times cheaper than the proper ones. I actually use mine as a VFO as well occasionally for receivers/transmitters.

If you’re just replacing a crystal or three, it’s worth looking at this: https://www.qrp-labs.com/progrock.html ... saves a lot of legwork! If you are so inclined you can even program it with the dip switches on board.
MrBungle is offline   Reply With Quote
Old 31st Aug 2019, 1:27 am   #9
Terry_VK5TM
Heptode
 
Join Date: Oct 2010
Location: Tintinara, South Australia, Australia
Posts: 901
Default Re: Embedded Control for a newbie

Just as a source of idea's for your project, I have one here using a PIC and AD9850 (sorry, it's in assembler, I don't get on well with C):

https://www.vk5tm.com/homebrew/xtal_sub/xtal_sub.php
__________________
Terry VK5TM
https://www.vk5tm.com/
Terry_VK5TM is offline   Reply With Quote
Old 31st Aug 2019, 10:06 am   #10
lesmw0sec
Heptode
 
Join Date: Jul 2009
Location: Carmel, Llannerchymedd, Anglesey, UK.
Posts: 847
Default Re: Embedded Control for a newbie

PIC's are hardly vintage, as the range seems to be increasing and still ideal for simple projects. I use them for the minor stuff as the interfacing is a lot easier for some things than the Pi. On the other hand, the Pi has the advantage of huge memory if you need it. I detest C++ and always use either C or assembler.
lesmw0sec is offline   Reply With Quote
Old 31st Aug 2019, 11:25 am   #11
RogerEvans
Pentode
 
Join Date: Oct 2014
Location: Wiltshire, UK.
Posts: 191
Default Re: Embedded Control for a newbie

Another vote for the Arduino. If you buy the Arduino mini you can get the version with built in USB for a few pounds in the UK and half of that from China but you will hear many warnings about the degree of risk if you buy direct.

Interfacing the Arduino to an AD9850 was one of my first projects and you rapidly find that the real problem is that you want to be able to set the frequency very precisely, maybe 1Hz in 10MHz which is seven digits of precision. If you use a potentiometer to set the frequency you probably want a multi-turn pot and then you find that the Arduino analogue to digital converter is only 10 bits (one part in 1024, so three digits of precision. So you probably want the Arduino to drive an LCD display (also straightforward and another useful thing to learn) and a more complicated input mechanism such as coarse and fine controls or a mixture of digital and analogue input. The you get to the 'human interface' and what pleases one person will be anathema to another but you will learn a lot on the way.

Definitely a fun project.

Roger
RogerEvans is offline   Reply With Quote
Old 31st Aug 2019, 11:52 am   #12
lesmw0sec
Heptode
 
Join Date: Jul 2009
Location: Carmel, Llannerchymedd, Anglesey, UK.
Posts: 847
Default Re: Embedded Control for a newbie

For controlling the AD9850, you might like to get some ideas from:

http://www.mw0sec.co.uk/amateur.html

(Scroll down to projects) where you can find the circuit and ASM code for one I built some years ago using a PIC.)

Les.
lesmw0sec is offline   Reply With Quote
Old 31st Aug 2019, 11:33 pm   #13
Julesomega
Hexode
 
Julesomega's Avatar
 
Join Date: Dec 2012
Location: Stockport, Greater Manchester, UK.
Posts: 414
Default Re: Embedded Control for a newbie

Thanks for the links to your own projects, I shall come back to those again. I shall take George's approach to using an Arduino as a test bed for an AVR system, that's exactly what I want, and I note the general thumbs-down for C++

In the first place I will learn how to set up a single frequency from the DDS modules and a precision of about 1 in 10^6 will be super. Next I will want to be able to set several discrete frequencies, as you might want for band switching. I shall look at the details of the ProgRock unit, might do what I want, but I need to explain why I mentioned using the analog input for channel switching. I'm not trying to tune or sweep anything with a multi-turn pot, I just want a few discrete frequencies. Say you want to simulate the 'band' crystals for a 6-band transceiver, would you use a 6-way switch and tie up 6 binary inputs, or would you try to find a hex switch and use 3 of the inputs? A programmer's answer would be to use push buttons, but if you are upgrading an old transceiver you would already have a 6-way rotary switch, so it seems sensible to make a ladder of 10k's around it and decode the ADC data with a few lines of of code (that's only one input line!)

So my first step is to make the traffic lights with Python, and when I can do that I'll be back with a few more questions.
__________________
- Julian

It's good here
Julesomega is offline   Reply With Quote
Old 1st Sep 2019, 12:56 am   #14
MrBungle
Dekatron
 
MrBungle's Avatar
 
Join Date: Jun 2016
Location: London, UK.
Posts: 3,373
Default Re: Embedded Control for a newbie

Progrock already solves that problem in a very easy way. It has three bank select inputs bits which are programmable in binary. Just connect your rotary switch wiper to +5V then wire up suitable series 1n4148 diodes (like a diode ROM) to each switch position so that the thing outputs 3 bit binary . Program your frequencies into output 1 in each bank and done. A 6 position switch will need only 9 diodes.

No ADC, no separate computer, nothing painful.
MrBungle is offline   Reply With Quote
Old 1st Sep 2019, 9:53 am   #15
Julesomega
Hexode
 
Julesomega's Avatar
 
Join Date: Dec 2012
Location: Stockport, Greater Manchester, UK.
Posts: 414
Default Re: Embedded Control for a newbie

d'oh, of course
__________________
- Julian

It's good here
Julesomega is offline   Reply With Quote
Reply

Thread Tools



All times are GMT +1. The time now is 5:02 am.


All information and advice on this forum is subject to the WARNING AND DISCLAIMER located at https://www.vintage-radio.net/rules.html.
Failure to heed this warning may result in death or serious injury to yourself and/or others.


Powered by vBulletin®
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Copyright ©2002 - 2019, Paul Stenning.