Saturday, August 20, 2016

Slic3r with GUI on OpenSUSE Leap 42.1

Just a working log as this was my probably 10th attempt to install Slic3r and I finally succeeded. So for the next time I reinstall OS, i need to have some records.

cd to RepetierHost directory
git clone https://github.com/alexrj/Slic3r.git

follow closely the step-by-step https://github.com/alexrj/Slic3r/wiki/Running-Slic3r-from-git-on-GNU-Linux (I used prereqs listed for OpenSUSE 13.2)

The following repos were added in the process:
http://download.opensuse.org/repositories/devel:/languages:/perl/openSUSE_Leap_42.1/
http://download.opensuse.org/repositories/devel:/languages:/perl:/CPAN-P/openSUSE_Leap_42.1/
http://download.opensuse.org/distribution/leap/42.1/repo/oss/

I also used http://software.opensuse.org/ to find a missing package, but already do not remember which one

When creating a launch script, had to use the absolute path for this line:
perl ./slic3r.pl $*

Finally, freeglut had to be installed (review the build error logs to see that GL\freeglut.h is missing).

This was solved by going to software management and installing packages freeglut-devel and perl-OpenGL

Finally after all the steps completed without errors, ./slic3r --gui should invoke a GUI window.

Some of the errors I saw in the process:

glversion.c:8:25: fatal error: GL/freeglut.h: No such file or directory

-> FAIL Configure failed for OpenGL-0.6704. See /home/user/.cpanm/work/1471705423.29187/build.log for details.

./slic3r --gui  Can't locate OpenGL.pm in @INC (you may need to install the OpenGL module)

Sunday, March 27, 2016

Hacking Honda Odyssey 2007 RES DVD-player: part 2

Part 1: Overview
Part 2: Hardware (This part)

Hardware


I finally built a PCB that works great and  even helped me to track down a nasty bug (took me a while, too. Hang on here with me, I'm actually going to tell you about it because it's fun).
But now, hardware.




Saturday, March 5, 2016

Hacking Honda Odyssey 2007 RES DVD-player: part 1

Part 1: Overview (this part)
Part 2: Hardware

Infotainment/NAVI system in Honda Odyssey 2007 is a huge monster – it has a luxury audio unit with 6 CD changer, a DVD-player, large NAVI screen in the dashboard, dashboard and steering wheel controls, rear screen with controls, IR remote and IR headphones. Awesome, isn't it?

Well, the problem is that we live in 2016 and it really does suck when you are stuck with the only choice between CDs and DVDs. If you want MP3, computer video, USB input, Bluetooth or anything else – your only option is the AUX input (composite video + stereo audio). It's definitely something, but if you are a maker, you can't be really satisfied with it, can you?

So I thought – why don't I look into how the hell this DVD works and if it would be possible to replace it with something more interesting and flexible – think a Raspberry PI or alike.


Sunday, March 30, 2014

Generate STM32 MCU pin configuration automatically on MCU

Building a project for STM32F4-Discovery I realized it's really hard to keep track of all the pins as they get configured in different files all over the project. It's either keeping a separate list of assignments and functions (maybe using STM's cube software) or just going through source files every time.

Or maybe just having MCU report how pins are configured?

Here's what I managed to get out of my STM32F407VGT6:
==============================
SMT32F407VG Configuration
------------------------------
PA0     Input           LOW,  NO_PULL
PA1     Input           LOW,  NO_PULL

Friday, December 6, 2013

Posting data from Arduino to Xively using bash

I decided to check if it is possible to post a sensor data to xively.com (ex cosm.com ex pachube.com) using bash only without building a complicated system like the one I attempted to build here: My first attempt to build a home monitoring/control system. And, in fact, it turned out to be quite simple.



We are going to need an Arduino with a temperature sensor that is able to answer to a string request with a float number representing sensor value. In my case, Arduino is programmed to send temperature in degrees Celsius if it receives a string "Get" over UART. So, what we need to do is to write a bash script that sends the string "Get" to a comport, recieves data and posts it to xively.com.

We are going to use /dev/ttyUSB0 comport (you may have a different one, so check this first), so let's declare a variable:


SERIAL_DEVICE=/dev/ttyUSB0

Now we can send data to the comport by just doing echo


echo "Get" > $SERIAL_DEVICE

And read data back by just doing read

read TEMP < $SERIAL_DEVICE

Here may be a few problems. Like speed of the port is not matching the speed of Arduino. Or the number of data or stop bits not matching. Or pretty much anything else not matching, so we have to make sure that the comport operates with the same parameters Arduino does. So before sending and receiving data to and from the comport, set its parameters:


stty -F $SERIAL_DEVICE cs8 9600 clocal -crtscts -cstopb -parenb -hup -ixany \
 igncr -ixoff -ixon -isig iexten >/dev/null

I was at this point able to communicate with Arduino, but I still had a problem of the Arduino resetting every time I echo to it. I was not able to overcome this problem, although it seems simple. Options like -hup (or -hupcl) and clocal have to solve the problem of DTR going down every time. But they don't. So what I do, is:
  1. I open the port:
    exec 3<>$SERIAL_DEVICE
    
  2. I wait for 3 seconds whil Arduino reboots:
    sleep 3
    
  3. I do my echo and read
  4. And I close the comport:
    exec 3>&-
    

So now I have the data from the sensor as a string and I just need to send this data to xively.com. I simply do that with cURL:


curl -ssss \
 --request PUT \
 --header "X-ApiKey: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" \
 --data "$DATA_STRING" \
 https://api.xively.com/v2/feeds/XXXXXXXXX > /dev/null

where $DATA_STRING is the data in json format:


DATA_STRING='{"version":"1.0.0", "datastreams":[{"id":"TC", "current_value":"'"$TEMP"'"}]}'


Here I had another problem when putting the variable directly into the string. Arduino sends "\r\n" as the end of the line when you use Serial.println(). And that '\r' totally corrupts the line. But we need the '\n' to detect the end of data. To get rid of '\r', you can use stty option igncr. So, the full script now looks as:
#!/bin/bash

#serial
SERIAL_DEVICE=/dev/ttyUSB0

#port setting
stty -F $SERIAL_DEVICE cs8 9600 clocal -crtscts -cstopb -parenb -hup -ixany \
 igncr -ixoff -ixon -isig iexten >/dev/null

sleep 0.1

exec 3<>$SERIAL_DEVICE
sleep 3

echo "Get" > $SERIAL_DEVICE
read TEMP < $SERIAL_DEVICE

DATA_STRING='{"version":"1.0.0", "datastreams":[{"id":"TC", "current_value":"'"$TEMP"'"}]}'
#echo "$DATA_STRING"

exec 3>&-

curl -ssss \
 --request PUT \
 --header "X-ApiKey: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" \
 --data "$DATA_STRING" \
 https://api.xively.com/v2/feeds/XXXXXXXXXX > /dev/null

So now save your script (I save it as ~/bin/xively), make it executable (chmod +x ~/bin/xively) and add it to the scheduler to execute regularly by typing crontab -e and adding the following line to your crontab:

*/2 * * * * ~/bin/xively

And now your sensor data is in the cloud! Check this out: https://xively.com/feeds/337476649