[Dev Log] Knock : Part 6 - My massive mistake

Django / Python / Knock / Hardware / AVR / ATMEL

So I used ATTiny2313. For a project that depends upon Analog To Digital Conversion. I USED A CHIP THAT DOESN'T HAVE AN ADC. But the good thing is it took me 6 hours to create a new board with ATMega88A-PU. Oh did I mention I got the ATMega88A-PU instead of the ATmega8 btw? Yeah, I did that too. Jeez, I need to be more careful. Anyway I had the new board up and running within 6 hours (I did sleep for 8 hours in between the 6 hours so if it makes any sense, it took me 14). I have the piezo and a photoresistor soldered on it. No more messing around with interrupts for now. Just ADC and serial. I haven't gotten around to writing the ADC program yet. But I tested the blinky.c file. Makefiles make everything easier. On a completely different note, I've made my first official Django app called Django-Associations. It has had about roughly 1.5K downloads. I am so happy! I will put in the dev log for that too. But for right now It's going to have to wait because I am working on Knock. What a goddamn mess. I need to…

[Dev Log] Knock : Part 5

Knock / Hardware / Projects / AVR / ATMEL

Serial on an 8 bit controller is hard to grasp. Especially if you're working in C. I mean you've got to take care of memory etc. So yeah, it's a bit annoying. No wonder Arduino was born. But hey, after much tinkering I finally did crack the code, so to speak. I had some help from the EvilMadScientist code. So here's my progress. /* Author: Pronoy Chopra Description: Serial implementation and test. */ #define F_CPU 8000000UL /*Using the internal clock with 8 prescalar*/ #define BAUD 9600UL #define BAUD_PRESCALE ((F_CPU / 16 / BAUD) - 1) #include <avr/io.h> #include <util/delay.h> #include <util/setbaud.h> void SerialWrite(unsigned long Data) { while(!(UCSRA & (1 > 8); UBRRL = BAUD_PRESCALE; //UCSRA |= (1 So when I configured pyserial to receive data from the controller, I received \x00 instead of the 'A' that I sent. It took me a while to realize that the compiler was throwing warnings. The BAUD and F_CPU were supposed to be configured as unsigned long types so the UBRR calculation wasn't correct. Now, when I fixed this, it worked just fine. So that's a good lesson. Heed the compiler's warnings yo. The…

[Dev Log] Knock : Part 4

Python / Hardware / Projects / AVR / ATMEL

AVR USART So I've been working with AVR USART today and I talked to some of the guys on #avr on freenode. Turns out _BV() is not a good way to do things. It was a hack apparently that was used by people before GCC was fixed. I didn't get too much into what was fixed but good practices are good practices so I am going to start putting values into registers using bit shift. Example: UCSRB |= (1 …

[Dev Log] Knock : Part 3

Python / Knock / Hardware / Projects / Ubuntu / AVR / ATMEL

So I am lazy and I like working on a linux environment. Don't get me wrong I love the Atmel Studio, it's got a lot of stuff, it's easy to use and it's got a great programming/debugging tool. But command line has its own charm. So here I explore/log how I programmed a custom board using AVR ISP MKII. Toolchain Ah Mac OS X. You're so silly. Almost makes me want to punch you in the face. But, I won't, you're expensive and you have a great package manager called Machomebrew. So I simply used it and did this DarkSector@DarkBook:~$ brew update DarkSector@DarkBook:~$ brew install libusb avr-binutils avr-gcc avr-libc avra avrdude Sweet, that went well. Now simply to go and write the code and generate the .hex or .elf files Compiling and linking AVR GCC, like the normal GCC follows the normal procedure of compiling linking etc. So this is the ATTiny2313 blink code and the set of commands to generate the hex file //blinky.c //Author: DarkSector #define F_CPU 1000000UL #include <avr/io.h> #include <util/delay.h> int main(void) { DDRB |= _BV(DDB4); while(1) { PORTB |= _BV(PORTB4); _delay…

[Dev Log] Knock : Part 2

Python / Knock / Hardware / Projects / Dev Log / AVR / ATMEL

So today I did two things. I set up the local server and I also soldered an ATTiny2313 onto a protoboard. The amazing part is that I got the board working the first time around. I was concerned for a while, how I did that. If it works the first time, something's about to blow up. Well, not really, but you can't trust electronics. Anyway, so here's the log for today Ubuntu Desktop 12.04 with Edimax EW-7811Un I admit I was frustrated two fold because first I didn't receive my WiFi dongle due to the holiday season and then when I did receive it, it didn't work out of the box. You can see the dongle detect all wireless networks, but you won't see it connect to the ones you want. So, conclusion: you need Realtek drivers. RTL8192CU. Anyway so I installed the drivers after downloading the Ubuntu OS update. Now this machine has only 512 MB of RAM and is a Compaq Presario. Remember those? Yeah, I have that as a server. It's not to bad though. But it did take some time to build. Anyway, rebooted machine after installing the drivers and it worked like a charm…

[Dev Log] Knock : Part 1

Knock / Hardware / Projects / Dev Log / Ubuntu / AVR / ATMEL

So I got my stuff on a Sunday. UPS really outdid themselves and awesome packaging my Digikey. Now I know who I am going to be ordering my stuff from, all the time. Interestingly Amazon is late. I understand not many people want eval boards for christmas. Anyway time to get onto the architecture. Let's start off with a diagram/mind map. So, the piezo is connected to the controller and the controller is connected to the server over an FTDI cable. The clients are connected to the network and so is the server. So, I am gonna have a Flask server listening to the clients' requests and whenever the request is made the server checks if there is any change in the incoming data. I can see some potential problem though. Since the client is gonna poll the server, there are gonna be a lot of requests. The requests are gonna land up in a certain window of time that may or may not coincide with the time data is incoming on the Serial port. So, the data window has to be extended. This implies the data coming from the controller has to be padded with the last known…

Knock : For the ones with headphones on all the time.

Knock / Hardware / Projects

Project Knock is my first personal hardware project after a long time. I haven't actually begun putting together the hardware right now, because it's not arrived yet. Waiting on UPS to deliver stuff that I ordered from Digikey. I am going to be doing it on AVR (no surprise there), ATTiny2313. I've created the repository and I intend to create the server on Ubuntu. The client is going to be Mac OS X 10.9 for now. Both, my roommate and I always have our headphones on and we miss most of our deliveries because we can't hear if anyone's knocking. So this is the solution. To get notifications on our Macs when we are working. Win. The project repository can be found here https://github.com/DarkSector/knock Here's the developer log for the whole project…

Deploying Django on Nginx using Gunicorn, Postgres and Supervisor

Django / Python / Migration / Nginx / Web / Gunicorn / Old Data

So I finally built my blog on Django. I've been working on this for quite a while. My code is on a private repository on Bitbucket right now because I have my production settings file in the open. Once I clean that up I'll make this repository public. So this time I am using Nginx instead of Apache as a web server. They both have their merits but I decided to go with Nginx because to me it seems much more easier to configure than the latter. I recently acquired a VPS on DigitalOcean and it's been great. It's cheap, fast and they have really good documentation. I am also using Gunicorn instead of mod_wsgi because I've had some really bad experiences with mod_wsgi on CentOS when I was working with IIT a year back. Gunicorn is directly integrated within Django so that makes things easier. Anyway, so this is how I did it. Installing Postgres and configuration So instead of using sqlite3 I am going to be using Postgres because of South compatibility. Since this is a low traffic website. I am hosting the DB Server on the same server instance. I simple followed the guide given…

Migrating from Django datastore

Django / Python / Migration

I moved to Ghost. Now I have to get the posts that I wrote using Django for my previous deployment. I am going to have to dump data here and then modify it and add markdown. That's going to be fun. Not.…

Welcome to here. I have no idea what I am doing.

First Post

So looks like it finally happened. I am now live on Ghost the blogging platform. It was just too pretty to avoid. I do however have to have it on a separate server instance I purchased from Digital Ocean. If you don't know about them, you should definitely check them out. They're awesome. Anyway, so what's up with me? Thanks for asking. Well, Django, AVR, Wireless Sensor Networks, JS a lot of C and a hell lot of planning. I am currently in my last semester (or so I hope) for a masters in Electrical & Computer Engineering degree at the University Of Oklahoma. This semester is not only crucial but incredibly hectic. I have to take about 4 courses that's 12 credit hours on top of my job as a graduate assitant at OU (I love my job). But it is going to be very difficult juggling them around. Once I am done here, the plan is to try and make a move to Colorado to help start a startup. Things will start to take shape in the next few months so I need to manage my time with that particular project too. As it so happens, that may…