Architecture

A "new fashioned" televisor, using an Arduino to drive the motor and display.

Moderators: Steve Anderson, Dave Moll, Andrew Davie

Architecture

Postby Andrew Davie » Mon Mar 13, 2017 1:56 am

I thought I'd jot down some notes on the architecture of the system I'm building. Mostly because I'm not exactly sure if the Arduino Micro can do everything I am planning, or even exactly sure what I'm planning! There are some limitations I'm finding now that I'm becoming more familiar with the capabilities of the Arduino, and hopefully putting these here as I find them will help me understand what's achievable. In particular, I'm concerned use of some features invalidate others.

IR Sensor

The IR sensor looks through timing holes (well, actually one at the moment) on the disc and triggers an interrupt when a hole is present. This trigger is on a falling edge of the IR voltage (which is 0-5V or thereabouts). The trigger voltage level is the 1.1V internal reference voltage of the ATmega32U4 chip.

The analog pin ADC7 (pin A0) is used in my current implementation as the comparator AIN1 value (i.e., the IR sensor).
This can be changed by setting bits MUX0..n in ADMUX.

From the manual pp.295 "It is possible to select any of the ADC13..0 pins to replace the negative input to the Analog Comparator. The ADC multiplexer is used to select this input, and consequently, the ADC must be switched off to utilize this feature. "

"AIN+ can be connected either to the AIN0 (PE6) pin, or to the internal Bandgap reference. AIN- can only be connected to the ADC multiplexer.

It looks like we can't use a comparator interrupt AND an ADC - and we need the ADC for the video input i'm really unclear on this - can't find any definitive answer by searching. Basically the above quotes say to me that the multiplexer is used to "replace" the negative input."AIN- can only be connected to the ADC multiplexer." (pp.293) So, with comparator in use we must use the ADC multiplexer and therefore we can't use the multiplexer for ADC, right?

" If ACME is cleared or ADEN is set, the Bandgap reference is applied to the negative input to the Analog Comparator."

Well, that's what we want! Can we have AIN0 as the *PIN* connected to the IR, and AIN1 connected to bandgap reference?
We would have to clear ACME and/or set ADEN.
ACME/ADEN/MUX2..0/Analog Comp Neg Input
0 x xxx Bandgap Ref.
1 1 xxx Bandgap Ref.

and I currenty have 1/0 which is "select ADC0 for neg input". Bzzt.
So I need ACME = 0 (do NOT enable multiplexer for comparator)
I need ADEN - 1 which is the ADC ENABLE.

Then I need to be able to select the AIN0 to be the pin for the IR.

pp. 293: " AIN+ can be connected either to the AIN0 (PE6) pin, or to the internal Bandgap reference. "

So, that's my only choice - connect AIN+ to PE6 pin, and AIN- to bandgap.
PE6 pin on Arduino is... mapped to digital pin 7

But anyway, in theory this frees up the ADC to do its stuff because we don't need/use the overloaded analog multiplexer to select AIN1.
So, that seems to clear that up. Will have to reconfigure and test in the next few days.
User avatar
Andrew Davie
"Gomez!", "Oh Morticia."
 
Posts: 1505
Joined: Wed Jan 24, 2007 4:42 pm
Location: Hobart, Tasmania, Australia

Re: Architecture

Postby Andrew Davie » Mon Mar 13, 2017 2:03 am

OK, per the attached, PE/AIN0 is the pin numbered "D7" (or just "7" in the other diagram I presented in another topic). That's where the IR sensor input goes! My task for tomorrow is to rework the IR code so it uses AIN0 as the input, AIN1 is the reference voltage. Essentially this means we can only have the comparator (with signal-in on D7 ONLY) if we want to do any ADC stuff. And, of course... we do! I'm planning at this stage to have the ADC running in 8-bit quick read to grab the NBTV video signal, though it has been suggested I could use other methods. However, with the IR taking the comparator then to use a comparator for anything else, the IR would have to be handled by an ADC/interrupt. One or the other.
Attachments
micropdf.pdf
(900.68 KiB) Downloaded 126 times
User avatar
Andrew Davie
"Gomez!", "Oh Morticia."
 
Posts: 1505
Joined: Wed Jan 24, 2007 4:42 pm
Location: Hobart, Tasmania, Australia

Re: Architecture

Postby Klaas Robers » Mon Mar 13, 2017 2:55 am

Andrew,

would it help you if you start with two Arduino's?

- Arduino 1 takes in the NBTV video signal,
- finds the sync bottom,
- moves that to a certain level, (adding a floating value, this in fact is called clamping)
- finds the missing sync pulse
- outputs a frame sync pulse to the other Arduino
- shifts the video number to black level
- performs gamma correction (later, for the time being linear)
- outputs the video to the PWM port.

- Arduino 2 looks at the IR sensor,
- makes a "binary" stream of it
- compares it to the incoming frame pulses from Arduino 1
- controls the disc motor.

Then, when this is running, you may make up your mind on how to shift these two processes into one.
User avatar
Klaas Robers
Frankenstein was my uncle.
 
Posts: 1420
Joined: Wed Jan 24, 2007 8:42 pm
Location: Valkenswaard, the Netherlands

Re: Architecture

Postby Andrew Davie » Mon Mar 13, 2017 11:12 am

Klaas Robers wrote:Andrew,

would it help you if you start with two Arduino's?

Then, when this is running, you may make up your mind on how to shift these two processes into one.



The sequence of events you list is in agreement with how I see things working, but I had not thought about detecting the bottom of sync and clamping, so I'm glad you mentioned it. I don't think that two Arduinos are needed at this stage; I would be disappointed if I had to do that to get it working. I think with my above "thinking out loud" I have solved the problem of the ADC being unavailable. I will test this out today and confirm, but I'm reasonably confident.

The point of my "construction diary" is not just to present the solved solution, but also to share the journey along the way. I'll be changing the way I do things occasionally, like with the comparator usage. Hopefully all of this documentation will help someone later on build their own, but as a minimum I am finding that writing it down (particularly the "thinking out loud" bits help me to understand and find solutions.

Thanks for your help and comment!
User avatar
Andrew Davie
"Gomez!", "Oh Morticia."
 
Posts: 1505
Joined: Wed Jan 24, 2007 4:42 pm
Location: Hobart, Tasmania, Australia

Re: Architecture

Postby Andrew Davie » Sun Apr 09, 2017 5:21 pm

Wanted to have a more current record of the pinout usage as it stands, so here 'tis...
Latest changes/additions in RED
Note: connection descriptions for power lines not relevant/correct for circuit board - only breadboard!


Image

MOSI --> blue of SD card (MOSI)
RX LED/SS
1/TX <--> Nextion RX (yellow)
0/RX <--> Nextion TX (blue)
RESET
GND --> GND of motor board --> speaker negative
2/SDA
3(PWM)/SCL --> output PWM for motor board
4/A6 --> purple of SD card (=CS select pin)
5(PWM) --> SD on PAM8302 (selects on/off and reduces pops)
6(PWM)/A7 --> speaker positive
7 <-- comparator input from IR sensor board
8/A8
9(PWM)/A9
10(PWM)/A10
11(PWM)
12/A11

13(PWM) --> LED driver board PWM output
3.3V
AREF
A0
A1
A2
A3
A4
A5
nc
nc
+5V --> +5V of IR control board, 5V of speaker board, 5V of nextion
RESET
GND --> GND of IR control board
VIN <--- +12V from motor AC/DC converter (shared with motor)
MISO --> green of SD card
SCK --> yellow of SD card

additionally,

5 "modules"...

1) LED control board
takes GND from IR control board
takes PWM from Arduino pin 13
takes GND and +22V from AC/DC converter board
outputs -/+ to LED array
"outputs" GND to SD reader (grey)

2) IR control board
takes +5V from Arduino +5V
takes GND from Arduino GND (right side)
"outputs" GND to LED board GND
"outputs" +5V to SD reader (orange)
outputs IR sync pulse to Arduino comparator on pin 7
outputs GND/5V to IR xmit
takes +/- from IR rcv

3) motor board
takes GND/+V (12V) from AC/DC converter board
outputs -/+ to motor
takes PWM from arduino pin 3
takes GND from arduino GND (left side)

4) sd card
grey --> LED GND
purple --> arduino pin 4 (CS select)
blue --> arduino MOSI
green --> arduino MISO
yellow --> arduino SCK
orange --> IR control +5V (SHOULD BE 3V3)!!!

5) Nextion
black GND --> arduino GND
yellow RX --> arduino TX
blue TX --> arduino RX
red +5V --> arduino +5V
User avatar
Andrew Davie
"Gomez!", "Oh Morticia."
 
Posts: 1505
Joined: Wed Jan 24, 2007 4:42 pm
Location: Hobart, Tasmania, Australia

Re: Architecture

Postby Andrew Davie » Wed Apr 26, 2017 12:28 am

Some notes on the final power configuration:

Currently i'm all over the shop with power; I'm feeding AC240V into two transformers which are giving me 9VAC and 15VAC (among others, but those are the two I'm using). Those are converted to DC giving me ~13V and ~22V. The 13V is driving the motor, and the 22V is driving the LED array. Meanwhile, the Arduino is being powered via its USB connector with 5V DC. The Arduino 5V out (a pass-through I understand, so the USB..) is powering the Nextion LCD.

Here's the plan - ditch the transformers. Get a 12V DC power brick/wall wart with about 1A capability. The Arduino can apparently handle 12V input, so we're good there. The Nextion is already powered sufficiently from the Arduino. The motor is happy with 12V. So all I need to do is rework the LED matrix so it can run off 12V. It's going to need higher current (well, for the same # LEDs) because instead of 8 strips of 5, I'm going to have to run something like 12 strips of 3. That would be about 300 mA. And the motor previously measured takes under 500 mA, and the Nextion - not sure, but the Arduino has a maximum recommended draw on the 5V pin of 500mA, I think. In any case, I'm fairly confident a 1A brick will be sufficient. Then I can use one of the simple plugs for power on my board and don't have to worry about the AC/DC converter boards or the bulky transformers I'm currently using.

The dream is to get my entire televisor circuitry onto a 5 cm x 7 cm breadboard (ha!) but I'll settle for something like 10 cm x 15 cm or so.
User avatar
Andrew Davie
"Gomez!", "Oh Morticia."
 
Posts: 1505
Joined: Wed Jan 24, 2007 4:42 pm
Location: Hobart, Tasmania, Australia

Re: Architecture

Postby Andrew Davie » Wed Apr 26, 2017 9:16 pm

Well, since I said my dream was to get it all on a 5x7 cm board, I thought I'd layout all the components and connectors and see if it was possible. The picture shows everything required to drive my current model televisor sitting on a 5x7 board. Looks do-able!

board.jpg
board.jpg (265.41 KiB) Viewed 3468 times


I was reminded, when sitting in my comfy thinking chair at work today, by a power brick sitting on my desk... that I was going to scout for a 12V 1A brick. So I picked it up and had a look... you know, just in case. Well, whaddya know... 12V 1A! So I guess it was meant to be. I found a connector too, which is in the above picture. So Hopefully just the one power source. I have to check my sacrificial Arduino running under external 12.22V DC (which is what this brick is putting out).


EDIT: I probably need to add a 4-pin connector for the Nextion LCD display!
User avatar
Andrew Davie
"Gomez!", "Oh Morticia."
 
Posts: 1505
Joined: Wed Jan 24, 2007 4:42 pm
Location: Hobart, Tasmania, Australia

Re: Architecture

Postby Andrew Davie » Thu Jun 08, 2017 9:04 pm

Revised, with 4 input pins for Nextion LCD...

board2.jpg
board2.jpg (306.83 KiB) Viewed 3466 times


Last bumped by Andrew Davie on Thu Jun 08, 2017 9:04 pm.
User avatar
Andrew Davie
"Gomez!", "Oh Morticia."
 
Posts: 1505
Joined: Wed Jan 24, 2007 4:42 pm
Location: Hobart, Tasmania, Australia


Return to Andrew Davie's Arduino Televisor

Who is online

Users browsing this forum: No registered users and 1 guest

cron